[patch gas]: Add 'e' for coff targets as section-specifier
Kai Tietz
ktietz70@googlemail.com
Tue Sep 27 18:36:00 GMT 2011
Hi,
this patch add 'e' as section specifier for an to be excluded section.
ChangeLog
2011-09-27 Kai Tietz <ktietz@redhat.com>
* config/obj-coff.c (obj_coff_section): Add 'e' as specifier
for marking section SEC_EXCLUDE.
2011-09-27 Kai Tietz <ktietz@redhat.com>
* gas/pe/pe.exp: Add new testcase.
* gas/pe/section-exclude.d: New file.
* gas/pe/section-exclude.s: New file.
Tested for x86_64-w64-mingw32, i686-w64-mingw32, and i686-pc-cygwin.
Ok for apply?
Regards,
Kai
Index: src/gas/config/obj-coff.c
===================================================================
--- src.orig/gas/config/obj-coff.c
+++ src/gas/config/obj-coff.c
@@ -1531,6 +1531,7 @@ coff_frob_file_after_relocs (void)
'o' for over
'w' for data
'd' (apparently m88k for data)
+ 'e' for exclude
'x' for text
'r' for read-only data
's' for shared data (PE)
@@ -1598,6 +1599,11 @@ obj_coff_section (int ignore ATTRIBUTE_U
}
switch (attr)
{
+ case 'e':
+ /* Exclude section from linking. */
+ flags |= SEC_EXCLUDE;
+ break;
+
case 'b':
/* Uninitialised data section. */
flags |= SEC_ALLOC;
Index: src/gas/testsuite/gas/pe/pe.exp
===================================================================
--- src.orig/gas/testsuite/gas/pe/pe.exp
+++ src/gas/testsuite/gas/pe/pe.exp
@@ -35,6 +35,7 @@ run_dump_test "aligncomm-d"
run_dump_test "section-align-1"
run_dump_test "section-align-3"
+run_dump_test "section-exclude"
# SEH related tests
Index: src/gas/testsuite/gas/pe/section-exclude.d
===================================================================
--- /dev/null
+++ src/gas/testsuite/gas/pe/section-exclude.d
@@ -0,0 +1,20 @@
+#objdump: -h
+#name: section exclude
+
+# Test that 'e' works in .section directives.
+
+.*: .*
+
+Sections:
+Idx Name *Size *VMA *LMA *File off *Algn
+ 3 .foo1 00000004 0000000000000000 0000000000000000 000000b4 2**2
+ CONTENTS, EXCLUDE
+ 0 \.text 0*0000000 0*0000000 0*0000000 0*0000000 2\*\*[24]
+.*
+ 1 \.data 0*0000000 0*0000000 0*0000000 0*0000000 2\*\*[24]
+.*
+ 2 \.bss 0*0000000 0*0000000 0*0000000 0*0000000 2\*\*[24]
+.*
+ 3 \.foo1 0*0000004 0*0000000 0*0000000 0*0000000 2\*\*[24]
+.*CONTENS, EXCLUDE
+.*
Index: src/gas/testsuite/gas/pe/section-exclude.s
===================================================================
--- /dev/null
+++ src/gas/testsuite/gas/pe/section-exclude.s
@@ -0,0 +1,2 @@
+ .section .foo1,"e"
+ .byte 0,0,0,0
More information about the Binutils
mailing list