diff mbox

[windows] : Support SECTION_EXCLUDE for pe-coff targets

Message ID CAEwic4bDd=-UUN8jwF2MGaJO4bj8iQTjdV7AXctXvtEYk13ZXQ@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Sept. 27, 2011, 7:58 p.m. UTC
Hi,

this patch enables same feature as in thread "[google] Add
SECTION_EXCLUDE flag and exclude .gnu.callgraph sections
(issue5126041)" for pe-coff x86 and x64 targets.

ChangeLog

2011-09-27  Kai Tietz  <ktietz@redhat.com>

	* configure.ac: Add test for new section attribute
	specifier "e" via define HAVE_GAS_SECTION_EXCLUDE.
	* config.in: Regenerated.
	* configure: Regenerated.
	* config/i386/winnt.c (i386_pe_asm_named_section): Emit
	new section flag "e" for excluded sections, if supported.

Tested for x86_64-w64-mingw32, i686-w64-mingw32, and i686-pc-cygwin.
Ok for apply?

Comments

Richard Henderson Sept. 27, 2011, 8:01 p.m. UTC | #1
On 09/27/2011 12:58 PM, Kai Tietz wrote:
> +#ifdef HAVE_GAS_SECTION_EXCLUDE
> +  if ((flags & SECTION_EXCLUDE) != 0)
> +    *f++ = 'e';
> +#endif

If 'e' is not supported, I wonder if we should emit 'n'?

Otherwise ok.


r~
Kai Tietz Sept. 27, 2011, 8:11 p.m. UTC | #2
2011/9/27 Richard Henderson <rth@redhat.com>:
> On 09/27/2011 12:58 PM, Kai Tietz wrote:
>> +#ifdef HAVE_GAS_SECTION_EXCLUDE
>> +  if ((flags & SECTION_EXCLUDE) != 0)
>> +    *f++ = 'e';
>> +#endif
>
> If 'e' is not supported, I wonder if we should emit 'n'?
>
> Otherwise ok.
>
>
> r~

This sounds fair.  At least we take care that section doesn't get
loaded into memory.
I adjust patch, retest it and then apply.

Thanks,
Kai
diff mbox

Patch

Index: gcc/gcc/config/i386/winnt.c
===================================================================
--- gcc.orig/gcc/config/i386/winnt.c
+++ gcc/gcc/config/i386/winnt.c
@@ -484,6 +484,11 @@  i386_pe_asm_named_section (const char *n
 {
   char flagchars[8], *f = flagchars;

+#ifdef HAVE_GAS_SECTION_EXCLUDE
+  if ((flags & SECTION_EXCLUDE) != 0)
+    *f++ = 'e';
+#endif
+
   if ((flags & (SECTION_CODE | SECTION_WRITE)) == 0)
     /* readonly data */
     {
Index: gcc/gcc/configure.ac
===================================================================
--- gcc.orig/gcc/configure.ac
+++ gcc/gcc/configure.ac
@@ -3553,6 +3553,15 @@  foo:	nop
 	      ;;
 	  esac
 	fi
+	# Test if the assembler supports the section flag 'e' for specifying
+	# an excluded section.
+	gcc_GAS_CHECK_FEATURE([.section with e], gcc_cv_as_section_has_e,
+	  [2,22,51],,
+[.section foo1,"e"
+.byte 0,0,0,0])
+	AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
+	  [`if test $gcc_cv_as_section_has_e = yes; then echo 1; else echo 0; fi`],
+          [Define if your assembler supports specifying the section flag e.])
 	;;
     esac