This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: work around HP ELF implementation of DT_INIT_ARRAY
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: binutils at sources dot redhat dot com
- Date: Thu, 26 Dec 2002 17:36:38 -0500 (EST)
- Subject: PATCH: work around HP ELF implementation of DT_INIT_ARRAY
I am working on a new technique for handling initializers and finalizers
on hppa64-hp-hpux11.X using DT_INIT_ARRAY and DT_FINI_ARRAY as HP doesn't
support DT_INIT and DT_FINI (you can guess why). For some reason, HP
decided to put the array initializers and finalizers in .init and .fini.
As a result, the HP attribute bits are inconsistent with the standard defines.
I need to make the bits consistent with HP's usage, or else I can't change to
the HP sections and I get warnings about inconsistent bits. There isn't much
choice here as special_sections has static linkage.
Tested on hppa64-hp-hpux11.11 with no regressions in testsuite results.
Ok (please don't laugh)?
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2002-12-26 John David Anglin <dave.anglin@nrc.ca>
* config/obj-elf.c (special_sections): Work around HP's incorrect usage
of .init and .fini sections for array initializers and finalizers.
Index: config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.58
diff -u -3 -p -r1.58 obj-elf.c
--- config/obj-elf.c 30 Nov 2002 08:39:42 -0000 1.58
+++ config/obj-elf.c 26 Dec 2002 19:03:51 -0000
@@ -609,8 +609,13 @@ static struct special_section const spec
{ ".data", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".data1", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ ".debug", SHT_PROGBITS, 0 },
+#if defined (TC_HPPA) && !defined (TE_LINUX) && TARGET_ARCH_SIZE == 64
+ { ".fini", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { ".init", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+#else
{ ".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
{ ".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+#endif
{ ".line", SHT_PROGBITS, 0 },
{ ".note", SHT_NOTE, 0 },
{ ".rodata", SHT_PROGBITS, SHF_ALLOC },