This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] Move additional section types to common code
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 8 Sep 2004 14:25:35 +0100
- Subject: [patch] Move additional section types to common code
- Organization: CodeSourcery
The patch below moves handling of SHT_INIT_ARRAY, SHT_FINI_ARRAY and
SHT_PREINIT_ARRAY from the ia64 code into the generic elf code.
We already implicitly support these section types via the warning in
obj_elf_change_section. This patch allows the user to explicitly specify them
in .section directives.
My main motivation for doing this is that the new ARM EABI also uses some of
these section types.
Tested with cross to arm-none-elf.
Ok?
Paul
2004-09-08 Paul Brook <paul@codesourcery.com>
* config/obj-elf.c (obj_elf_section_type): Handle init_array,
fini_array and preinit_array section types.
* config/tc-ia64.c (ia64_elf_section_type): Remove init_array
and fini_array.
* doc/as.texinfo: Document extra section types.
Index: config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.85
diff -u -p -r1.85 obj-elf.c
--- config/obj-elf.c 15 Jun 2004 01:16:35 -0000 1.85
+++ config/obj-elf.c 8 Sep 2004 12:31:09 -0000
@@ -771,6 +771,12 @@ obj_elf_section_type (char *str, size_t
return SHT_NOBITS;
if (len == 4 && strncmp (str, "note", 4) == 0)
return SHT_NOTE;
+ if (len == 10 && strncmp (str, "init_array", 10) == 0)
+ return SHT_INIT_ARRAY;
+ if (len == 10 && strncmp (str, "fini_array", 10) == 0)
+ return SHT_FINI_ARRAY;
+ if (len == 13 && strncmp (str, "preinit_array", 13) == 0)
+ return SHT_PREINIT_ARRAY;
#ifdef md_elf_section_type
{
Index: config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.115
diff -u -p -r1.115 tc-ia64.c
--- config/tc-ia64.c 18 Aug 2004 09:51:29 -0000 1.115
+++ config/tc-ia64.c 8 Sep 2004 12:31:12 -0000
@@ -996,12 +996,6 @@ ia64_elf_section_type (str, len)
if (STREQ ("unwind"))
return SHT_IA_64_UNWIND;
- if (STREQ ("init_array"))
- return SHT_INIT_ARRAY;
-
- if (STREQ ("fini_array"))
- return SHT_FINI_ARRAY;
-
return -1;
#undef STREQ
}
Index: doc/as.texinfo
===================================================================
RCS file: /cvs/src/src/gas/doc/as.texinfo,v
retrieving revision 1.104
diff -u -p -r1.104 as.texinfo
--- doc/as.texinfo 17 Aug 2004 12:19:57 -0000 1.104
+++ doc/as.texinfo 8 Sep 2004 12:31:15 -0000
@@ -5291,8 +5291,16 @@ section contains data
section does not contain data (i.e., section only occupies space)
@item @@note
section contains data which is used by things other than the program
+@item @@init_array
+section contains an array of pointers to init functions
+@item @@fini_array
+section contains an array of pointers to finish functions
+@item @@preinit_array
+section contains an array of pointers to pre-init functions
@end table
+Many targets only support the first three section types.
+
Note on targets where the @code{@@} character is the start of a comment (eg
ARM) then another character is used instead. For example the ARM port uses
the
@code{%} character.