diff mbox

[uclibc-ng-devel] ARC uClibc-ng testsuite runs empty ?

Message ID EB86EB452ADE4B44B294F7149B8A277702249BD7@DE02WEMBXB.internal.synopsys.com
State New
Headers show

Commit Message

Cupertino Miranda Jan. 13, 2017, 3:06 p.m. UTC
Hi Waldemar,

I have looked into the OpenADK uclibc-tests segmentation fault at hand.
Although, I haven't fully tested the patch I think it is a fix for the
issue.

Considering how long I took to look into this problem, I decided to
provide you a patch immediately for you to try it.
BTW, in my case, it fails a little further, but because of some
undefined references.
Maybe it is not really a problem on the toolchain.

Best regards,
Cupertino

On 01/11/2017 11:40 PM, Waldemar Brodkorb wrote:
> Hi,
> Vineet Gupta wrote,
>
>> On 01/11/2017 12:48 PM, Waldemar Brodkorb wrote:
>>> I reported the issue to Alexey last year.
>>> We added your binutils maintainer to the thread.
>>> Yesterday he had again time to reproduce the problem, but there was
>>> some missing information I gave him yesterday.
>>>
>>> So may be you can help with this?
>> It is beyond my area of expertise and Cuper is looking into it, it is in good
>> hands already ;-)
>>
>> OTOH the reason I was dabbling into this was to track down tst-getpid2 failure on
>> ARC as reported in last known reports.
>>
>> It seems glibc dropped this test and added a new one instead. See commit
>> 0cb313f7cb0e41 ("Fix clone (CLONE_VM) pid/tid reset (BZ#19957)")
>>
>> I tried copying over tst-clone2 into uClibc (with a hdr include adjustment), but
>> it seems to runtime fail for me very early (atleast in nSIM).
>>
>> | [ARCLinux]# ./tst-clone2
>> | child pid (62) != received pid/tid (0/1606237724)
>> | parent pid (61) != received pid/tid (0/1606237724)
>> | [ARCLinux]# random: crng init done
>> | echo $?
>> | 2
>>
>> Can you please double check this for other targets !
> I have yesterday seen this commit
> c579f48edba88380635ab98cb612030e3ed8691e in glibc and would 
> like to follow here and remove any PID/TID caching.
>
> Afterwards I can take a look into 0cb313f7cb0e41.
>  
>>> It is really blocking any complete regression testing :( 
>> I know sucks, lets hope Cuper nails it down quickly.
> That would be really cool.
>
> best regards
>  Waldemar
>

Comments

Waldemar Brodkorb Jan. 14, 2017, 7:01 p.m. UTC | #1
Hi,
Cupertino Miranda wrote,

> Hi Waldemar,
> 
> I have looked into the OpenADK uclibc-tests segmentation fault at hand.
> Although, I haven't fully tested the patch I think it is a fix for the
> issue.
> 
> Considering how long I took to look into this problem, I decided to
> provide you a patch immediately for you to try it.
> BTW, in my case, it fails a little further, but because of some
> undefined references.
> Maybe it is not really a problem on the toolchain.

Works for me! Thanks.
But what do you mean with not a problem with toolchain when
a change to binutils fixes it for me?
Can you explain why this happens for OpenADK but not for buildroot?

best regards
 Waldemar
diff mbox

Patch

diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index fba58cb..d99da93 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -70,13 +70,7 @@  name_for_global_symbol (struct elf_link_hash_entry *h)
 struct dynamic_sections
 {
   bfd_boolean	  initialized;
-  asection *      sgot;
-  asection *      srelgot;
-  asection *      sgotplt;
-  asection *      srelgotplt;
   asection *      sdyn;
-  asection *      splt;
-  asection *      srelplt;
 };
 
 enum dyn_section_types
@@ -1578,13 +1572,7 @@  arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
   struct dynamic_sections ds =
     {
       .initialized = FALSE,
-      .sgot = NULL,
-      .srelgot = NULL,
-      .sgotplt = NULL,
-      .srelgotplt = NULL,
       .sdyn = NULL,
-      .splt = NULL,
-      .srelplt = NULL
     };
 
   htab = elf_hash_table (info);
@@ -1592,7 +1580,7 @@  arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
 
   /* Create dynamic sections for relocatable executables so that we
      can copy relocations.  */
-  if (! htab->dynamic_sections_created && bfd_link_pic (info))
+  if (! htab->dynamic_sections_created)
     {
       if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
 	BFD_ASSERT (0);
@@ -1600,18 +1588,6 @@  arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
 
   dynobj = (elf_hash_table (info))->dynobj;
 
-  if (dynobj)
-    {
-      ds.sgot = htab->sgot;
-      ds.srelgot = htab->srelgot;
-
-      ds.sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
-      ds.srelgotplt = ds.srelplt;
-
-      ds.splt = bfd_get_section_by_name (dynobj, ".plt");
-      ds.srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
-    }
-
   if (htab->dynamic_sections_created)
     {
       ds.sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
@@ -1634,10 +1610,20 @@  elf_arc_check_relocs (bfd *			 abfd,
   const Elf_Internal_Rela *	rel_end;
   bfd *				dynobj;
   asection *			sreloc = NULL;
+  struct elf_link_hash_table *	htab = elf_hash_table (info);
 
   if (bfd_link_relocatable (info))
     return TRUE;
 
+  if (htab->dynobj == NULL)
+    htab->dynobj = abfd;
+
+  if (! htab->dynamic_sections_created)
+    {
+      if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
+	return FALSE;
+    }
+
   dynobj = (elf_hash_table (info))->dynobj;
   symtab_hdr = &((elf_tdata (abfd))->symtab_hdr);
   sym_hashes = elf_sym_hashes (abfd);
@@ -1659,15 +1645,6 @@  elf_arc_check_relocs (bfd *			 abfd,
 	}
       howto = arc_elf_howto (r_type);
 
-      if (dynobj == NULL
-	  && (is_reloc_for_GOT (howto) == TRUE
-	      || is_reloc_for_TLS (howto) == TRUE))
-	{
-	  dynobj = elf_hash_table (info)->dynobj = abfd;
-	  if (! _bfd_elf_create_got_section (abfd, info))
-	    return FALSE;
-	}
-
       /* Load symbol information.  */
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol.  */