This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR ld/16428: autoconf tests don't terminate on ix86-linux-gnu with -static -fPIE -pie on glibc-2.18 based systems


On Wed, Jan 15, 2014 at 07:49:57PM +1030, Alan Modra wrote:
> I really don't want to hack all the backends.  So, lets see if this
> generic hack passes testing..

The test results are in, with failures on frv-linux, crisv32-linux,
i370-linux and all mips-linux targets.  The first two are caused by
complaints about relocation types in shared libs, so I'll just xfail
the test.  i370-linux has so many failures that I reckon the port
should be declared dead.  The mips failures

mips-linux  +FAIL: MIPS magic __ehdr_start symbol test 1 (n32)
mips-linux  +FAIL: MIPS magic __ehdr_start symbol test 1 (n64)

are due to this code in mips_elf_record_got_page_entry

      entry = bfd_zalloc (sec->owner, sizeof (*entry));

When a symbol is absolute, sec == bfd_abs_section_ptr and
sec->owner == NULL.  Methinks I've found a bug in the mips backend,
rather than there being anything wrong with my __ehdr_start patch.
Not being a mips expert, I'm asking for an OK from a mips maintainer
before committing this part of the patch.

bfd/
	* elfxx-mips.c (mips_elf_record_got_page_entry): Pass in a
	mips_elf_traverse_got_arg* rather than mips_got_info*.
	Adjust caller.  Alloc on output_bfd rather than symbol section
	owner.
ld/testsuite/
	* ld-elf/ehdr_start-shared.d: xfail cris and frv.
	* ld-elf/ehdr_start-userdef.d: xfail frv.
	* ld-elf/ehdr_start-weak.d: Likewise.
	* ld-elf/ehdr_start.d: Likewise.

diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index d5f51a3..f51845b 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -4089,9 +4089,10 @@ mips_elf_pages_for_range (const struct mips_got_page_range *range)
 /* Record that G requires a page entry that can reach SEC + ADDEND.  */
 
 static bfd_boolean
-mips_elf_record_got_page_entry (struct mips_got_info *g,
+mips_elf_record_got_page_entry (struct mips_elf_traverse_got_arg *arg,
 				asection *sec, bfd_signed_vma addend)
 {
+  struct mips_got_info *g = arg->g;
   struct mips_got_page_entry lookup, *entry;
   struct mips_got_page_range **range_ptr, *range;
   bfd_vma old_pages, new_pages;
@@ -4108,7 +4109,7 @@ mips_elf_record_got_page_entry (struct mips_got_info *g,
   entry = (struct mips_got_page_entry *) *loc;
   if (!entry)
     {
-      entry = bfd_zalloc (sec->owner, sizeof (*entry));
+      entry = bfd_zalloc (arg->info->output_bfd, sizeof (*entry));
       if (!entry)
 	return FALSE;
 
@@ -4128,7 +4129,7 @@ mips_elf_record_got_page_entry (struct mips_got_info *g,
   range = *range_ptr;
   if (!range || addend < range->min_addend - 0xffff)
     {
-      range = bfd_zalloc (sec->owner, sizeof (*range));
+      range = bfd_zalloc (arg->info->output_bfd, sizeof (*range));
       if (!range)
 	return FALSE;
 
@@ -4248,7 +4249,7 @@ mips_elf_resolve_got_page_ref (void **refp, void *data)
       else
 	addend = isym->st_value + ref->addend;
     }
-  if (!mips_elf_record_got_page_entry (arg->g, sec, addend))
+  if (!mips_elf_record_got_page_entry (arg, sec, addend))
     {
       arg->g = NULL;
       return 0;
diff --git a/ld/testsuite/ld-elf/ehdr_start-shared.d b/ld/testsuite/ld-elf/ehdr_start-shared.d
index 51c4e66..c17516a 100644
--- a/ld/testsuite/ld-elf/ehdr_start-shared.d
+++ b/ld/testsuite/ld-elf/ehdr_start-shared.d
@@ -2,6 +2,7 @@
 #ld: -e _start -shared
 #nm: -n
 #target: *-*-linux* *-*-gnu* *-*-nacl*
+#xfail: cris*-*-* frv-*-*
 
 #...
 [0-9a-f]*000 [Adrt] __ehdr_start
diff --git a/ld/testsuite/ld-elf/ehdr_start-userdef.d b/ld/testsuite/ld-elf/ehdr_start-userdef.d
index 2a88e98..b58ae3f 100644
--- a/ld/testsuite/ld-elf/ehdr_start-userdef.d
+++ b/ld/testsuite/ld-elf/ehdr_start-userdef.d
@@ -2,6 +2,7 @@
 #ld: -e _start -T ehdr_start-userdef.t
 #readelf: -Ws
 #target: *-*-linux* *-*-gnu* *-*-nacl*
+#xfail: frv-*-*
 
 #...
 Symbol table '\.symtab' contains [0-9]+ entries:
diff --git a/ld/testsuite/ld-elf/ehdr_start-weak.d b/ld/testsuite/ld-elf/ehdr_start-weak.d
index 8bd9035..24ae34c 100644
--- a/ld/testsuite/ld-elf/ehdr_start-weak.d
+++ b/ld/testsuite/ld-elf/ehdr_start-weak.d
@@ -2,6 +2,7 @@
 #ld: -e _start -T ehdr_start-missing.t
 #nm: -n
 #target: *-*-linux* *-*-gnu* *-*-nacl*
+#xfail: frv-*-*
 
 #...
 \s+[wU] __ehdr_start
diff --git a/ld/testsuite/ld-elf/ehdr_start.d b/ld/testsuite/ld-elf/ehdr_start.d
index 52e5b54..d538b66 100644
--- a/ld/testsuite/ld-elf/ehdr_start.d
+++ b/ld/testsuite/ld-elf/ehdr_start.d
@@ -2,6 +2,7 @@
 #ld: -e _start
 #nm: -n
 #target: *-*-linux* *-*-gnu* *-*-nacl*
+#xfail: frv-*-*
 
 #...
 [0-9a-f]*000 [Adrt] __ehdr_start

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]