This is the mail archive of the 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] Fixes for GNU ld on amd64 Solaris

On Wed, Jun 28, 2006 at 10:16:09AM +0100, Michael Wetherell wrote:
> 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 is bad:
1) you shouldn't define SHT_GNU_dof etc. - the reason why SHT_GNU_versym
etc. are defined the same as SHT_SUNW_* is because the GNU symbol versioning
uses them.  The SHT_SUNW_* types you are adding are not used for any GNU
feature (therefore shouldn't be in GNU namespace) and worse they clash
with GNU section types.
Linux (and GNU ld too) has:
#define SHT_GNU_LIBLIST   0x6ffffff7    /* Prelink library list */
#define SHT_CHECKSUM      0x6ffffff8    /* Checksum for DSO content.  */
#define SHT_LOSUNW        0x6ffffffa    /* Sun-specific low bound.  */
#define SHT_SUNW_move     0x6ffffffa
#define SHT_SUNW_COMDAT   0x6ffffffb
#define SHT_SUNW_syminfo  0x6ffffffc
#define SHT_GNU_verdef    0x6ffffffd    /* Version definition section.  */
#define SHT_GNU_verneed   0x6ffffffe    /* Version needs section.  */
#define SHT_GNU_versym    0x6fffffff    /* Version symbol table.  */
#define SHT_HISUNW        0x6fffffff    /* Sun-specific high bound.  */
(and one patch we're working on uses 0x6ffffff6 section type).

Solaris 10 use clashes with this, clearly they keep decreasing SHT_LOSUNW:
#define SHT_LOSUNW              0x6ffffff4
#define SHT_SUNW_dof            0x6ffffff4
#define SHT_SUNW_cap            0x6ffffff5
#define SHT_SUNW_SIGNATURE      0x6ffffff6
#define SHT_SUNW_ANNOTATE       0x6ffffff7
#define SHT_SUNW_DEBUGSTR       0x6ffffff8
#define SHT_SUNW_DEBUG          0x6ffffff9
#define SHT_SUNW_move           0x6ffffffa
#define SHT_SUNW_COMDAT         0x6ffffffb
#define SHT_SUNW_syminfo        0x6ffffffc
#define SHT_SUNW_verdef         0x6ffffffd
#define SHT_SUNW_verneed        0x6ffffffe
#define SHT_SUNW_versym         0x6fffffff
#define SHT_HISUNW              0x6fffffff

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.


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