This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [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: Fri, 14 Jul 2006 15:50:43 +0100
- Subject: Re: [PATCH] Fixes for GNU ld on amd64 Solaris
- References: <200606281016.09816.mike.wetherell@ntlworld.com> <20060628113240.GW3823@sunsite.mff.cuni.cz> <200606281246.01074.mike.wetherell@ntlworld.com>
On Wednesday 28 Jun 2006 12:32, Jakub Jelinek wrote:
> That's itself OK, this is all in OS range, but you really can't use
> OS specific SHT_* tags in generic code if they can have multiple
> meanings. You need to use switch on the ELF's OS.
Hi,
I thought I should read-up before trying again. It seems that
unrecognised OS specific sections shouldn't cause an error unless
SHF_OS_NONCONFORMING is in the flag bits:
http://www.caldera.com/developers/gabi/latest/ch4.sheader.html#linking_rules
The patch below does that and programs do link now (this other patch is
need too http://sources.redhat.com/ml/binutils/2006-06/msg00431.html).
bfd/ChangeLog
2006-07-14 Michael Wetherell <mike.wetherell@ntlworld.com>
* elf.c (bfd_section_from_shdr): Reject unrecognised OS-specific
sections only if the SHF_OS_NONCONFORMING flag is present.
ld/ChangeLog
2006-07-14 Michael Wetherell <mike.wetherell@ntlworld.com>
* emulparams/elf_x86_64.sh (LIBPATH_SUFFIX, ELF_INTERPRETER_NAME):
Set for *-*-solaris2*.
There is a wider problem though. What you were saying about checking the
ELF's OS before looking at the OS-specific tags also applies to the GNU
tags. And the problem with doing that is that e_ident[EI_OSABI] isn't
being set currently.
It seems that the original intention was that e_ident[EI_OSABI] would be
set if any OS-specific extensions were present see:
http://www.cygwin.com/ml/binutils/2000-11/msg00383.html
Regards,
Mike
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.348
diff -u -r1.348 elf.c
--- bfd/elf.c 10 Jul 2006 21:40:23 -0000 1.348
+++ bfd/elf.c 13 Jul 2006 23:54:56 -0000
@@ -2201,11 +2201,20 @@
"`%s' [0x%8x]"),
abfd, name, hdr->sh_type);
else if (hdr->sh_type >= SHT_LOOS && hdr->sh_type <= SHT_HIOS)
- /* FIXME: We should handle this section. */
- (*_bfd_error_handler)
- (_("%B: don't know how to handle OS specific section "
- "`%s' [0x%8x]"),
- abfd, name, hdr->sh_type);
+ {
+ /* Unrecognised OS-specific sections. */
+ if ((hdr->sh_flags & SHF_OS_NONCONFORMING) != 0)
+ /* SHF_OS_NONCONFORMING indicates that special knowledge is
+ required to correctly process the section and the file should
+ be rejected with an error message. */
+ (*_bfd_error_handler)
+ (_("%B: don't know how to handle OS specific section "
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+ /* Otherwise it should be processed. */
+ return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+ }
else
/* FIXME: We should handle this section. */
(*_bfd_error_handler)
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 -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 13 Jul 2006 23:54:59 -0000
@@ -22,7 +22,7 @@
esac
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
x86_64*-linux*)
@@ -30,4 +30,8 @@
*64*) LIBPATH_SUFFIX=64 ;;
esac
;;
+ *-*-solaris2*)
+ LIBPATH_SUFFIX=/amd64
+ ELF_INTERPRETER_NAME=\"/lib/amd64/ld.so.1\"
+ ;;
esac