This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fixes for GNU ld on amd64 Solaris
- From: Michael Wetherell <mike dot wetherell at ntlworld dot com>
- To: binutils at sourceware dot org
- Date: Wed, 28 Jun 2006 10:16:09 +0100
- Subject: [PATCH] Fixes for GNU ld on amd64 Solaris
Hi,
ld has been giving the following error on Solaris x86-64:
/usr/lib/amd64/crti.o: file not recognized: File format not recognized
I found under a debugger that it's because of an unknown header type
0x6ffffff6 (SHT_SUNW_signature). Then searching for that, I discovered
that they've already fixed in OpenSolaris, and that they also added two
more: SHT_SUNW_dof and SHT_SUNW_syminfo.
The patch below ignores these three headers and also sets LIBPATH_SUFFIX
and ELF_INTERPRETER_NAME. I've checked that gcc now builds
--with-gnu-ld both natively and as a cross compiler, and compiled some
large projects with it.
Regards,
Mike
bfd/ChangeLog
2006-06-28 Michael Wetherell <mike.wetherell@ntlworld.com>
* elf.c (bfd_section_from_shdr): ingore Sun section types
SHT_GNU_syminfo, SHT_GNU_signature and SHT_GNU_dof.
include/elf/ChangeLog
2006-06-28 Michael Wetherell <mike.wetherell@ntlworld.com>
* common.h (SHT_SUNW_dof, SHT_SUNW_signature, SHT_SUNW_syminfo): New.
* common.h (SHT_GNU_dof, SHT_GNU_signature, SHT_GNU_syminfo): Define
GNU versions of the new SUNW defines.
ld/ChangeLog
2006-06-28 Michael Wetherell <mike.wetherell@ntlworld.com>
* configure.tgt (i[3-7]86-*-solaris2*, i[3-7]86-*-solaris*): Correct
typo setting targ_extra_libpath.
* emulparams/elf_x86_64.sh (LIBPATH_SUFFIX, ELF_INTERPRETER_NAME):
Set for *-*-solaris2*.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.347
diff -u -2 -r1.347 elf.c
--- bfd/elf.c 23 Jun 2006 02:58:00 -0000 1.347
+++ bfd/elf.c 28 Jun 2006 00:32:08 -0000
@@ -2104,4 +2104,9 @@
break;
+ case SHT_GNU_dof:
+ case SHT_GNU_signature:
+ case SHT_GNU_syminfo:
+ return TRUE;
+
case SHT_GNU_verdef:
elf_dynverdef (abfd) = shindex;
Index: include/elf/common.h
===================================================================
RCS file: /cvs/src/src/include/elf/common.h,v
retrieving revision 1.77
diff -u -2 -r1.77 common.h
--- include/elf/common.h 17 Feb 2006 14:36:26 -0000 1.77
+++ include/elf/common.h 28 Jun 2006 00:41:58 -0000
@@ -341,14 +341,20 @@
#define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */
-/* The next three section types are defined by Solaris, and are named
+/* The next six section types are defined by Solaris, and are named
SHT_SUNW*. We use them in GNU code, so we also define SHT_GNU*
versions. */
-#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
-#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
-#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
-
-#define SHT_GNU_verdef SHT_SUNW_verdef
-#define SHT_GNU_verneed SHT_SUNW_verneed
-#define SHT_GNU_versym SHT_SUNW_versym
+#define SHT_SUNW_dof 0x6ffffff4 /* Solaris DTrace Object Format */
+#define SHT_SUNW_signature 0x6ffffff6 /* Solaris Cryptographic Framework: Digital Signature */
+#define SHT_SUNW_syminfo 0x6ffffffc /* Symbol information */
+#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
+#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
+#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
+
+#define SHT_GNU_dof SHT_SUNW_dof
+#define SHT_GNU_signature SHT_SUNW_signature
+#define SHT_GNU_syminfo SHT_SUNW_syminfo
+#define SHT_GNU_verdef SHT_SUNW_verdef
+#define SHT_GNU_verneed SHT_SUNW_verneed
+#define SHT_GNU_versym SHT_SUNW_versym
#define SHT_LOPROC 0x70000000 /* Processor-specific semantics, lo */
Index: ld/configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.189
diff -u -2 -r1.189 configure.tgt
--- ld/configure.tgt 23 Jun 2006 18:11:47 -0000 1.189
+++ ld/configure.tgt 28 Jun 2006 00:42:40 -0000
@@ -164,10 +164,10 @@
i[3-7]86-*-solaris2*) targ_emul=elf_i386_ldso
targ_extra_emuls="elf_i386 elf_x86_64"
- targ_extra_libpath=$target_extra_emuls
+ targ_extra_libpath=$targ_extra_emuls
;;
i[3-7]86-*-unixware) targ_emul=elf_i386 ;;
i[3-7]86-*-solaris*) targ_emul=elf_i386_ldso
targ_extra_emuls="elf_i386"
- targ_extra_libpath=$target_extra_emuls
+ targ_extra_libpath=$targ_extra_emuls
;;
i[3-7]86-*-netbsdelf* | \
Index: ld/emulparams/elf_x86_64.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf_x86_64.sh,v
retrieving revision 1.17
diff -u -2 -r1.17 elf_x86_64.sh
--- ld/emulparams/elf_x86_64.sh 30 May 2006 16:45:32 -0000 1.17
+++ ld/emulparams/elf_x86_64.sh 28 Jun 2006 00:42:47 -0000
@@ -23,5 +23,5 @@
fi
-# Linux modify the default library search path to first include
+# Linux/solaris modify the default library search path to first include
# a 64-bit specific directory.
case "$target" in
@@ -31,3 +31,7 @@
esac
;;
+ *-*-solaris2*)
+ LIBPATH_SUFFIX=/amd64
+ ELF_INTERPRETER_NAME=\"/lib/amd64/ld.so.1\"
+ ;;
esac