This is the mail archive of the binutils@sources.redhat.com 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: ld-srec failure on x86-64


On Fri, Jan 17, 2003 at 04:30:43PM +0100, Andreas Jaeger wrote:
> 
> I've reported in november [1]that the ld-srec testcase fails on
> x86_64-linux-gnu.
> 
> I did now a binary search for the patch that caused this failure and
> it's this patch [2]:
> 
>  2002-11-12  Alan Modra  <amodra@bigpond.net.au>

Done it again, have I?

> Any ideas why this fails on x86-64?  I'm lost - and don't know enough
> about S-records to make a better guess.  

With the ELF eh_frame info now stashed in the hash table, we can't do
eh_frame optimization with non-ELF output.  IMO that's no big deal, as
srec output is broken in worse ways than this on many targets.  Fixed
with a tweak to the testsuite.

ld/testsuite/ChangeLog
	* ld-srec/srec.exp (run_srec_test): Pass --traditional-format to ld.

Index: ld/testsuite/ld-srec/srec.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-srec/srec.exp,v
retrieving revision 1.13
diff -u -p -r1.13 srec.exp
--- ld/testsuite/ld-srec/srec.exp	3 Dec 2002 18:24:33 -0000	1.13
+++ ld/testsuite/ld-srec/srec.exp	20 Jan 2003 07:30:39 -0000
@@ -225,7 +225,8 @@ proc run_srec_test { test objs } {
     global sizeof_headers
     global host_triplet
 
-    set flags ""
+    # Tell the ELF linker to not do anything clever with .eh_frame.
+    set flags "--traditional-format"
 
     # If the linker script uses SIZEOF_HEADERS, use a -Ttext argument
     # to force both the normal link and the S-record link to be put in

> Can I convert those S-records back into another format that is more
> readable to me?  The obvious one does not work:
> $ objcopy -I symbolsrec -O elf64-x86-64 sr1.sr aj
> objcopy: Warning: Output file cannot represent architecture UNKNOWN!

Yeah, this is a pain.  Some special hacks for binary input were added
some time ago (bfd_external_binary_architecture), that really should
have been done for srec and other targets too.  Or something like the
following..

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.174
diff -u -p -r1.174 elf.c
--- bfd/elf.c	28 Dec 2002 21:15:35 -0000	1.174
+++ bfd/elf.c	20 Jan 2003 07:31:37 -0000
@@ -5955,11 +5955,14 @@ _bfd_elf_set_arch_mach (abfd, arch, mach
      enum bfd_architecture arch;
      unsigned long machine;
 {
+  struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+  if (arch == bfd_arch_unknown)
+    arch = bed->arch;
+
   /* If this isn't the right architecture for this backend, and this
      isn't the generic backend, fail.  */
-  if (arch != get_elf_backend_data (abfd)->arch
-      && arch != bfd_arch_unknown
-      && get_elf_backend_data (abfd)->arch != bfd_arch_unknown)
+  else if (arch != bed->arch && bed->arch != bfd_arch_unknown)
     return FALSE;
 
   return bfd_default_set_arch_mach (abfd, arch, machine);

The trouble with this trick is that non-ELF targets don't have a similar
tie between target and arch.  Comments?

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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