This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[PATCH ARM 1/2] Add support for section attribute letter 'y' when available


gcc/ChangeLog:

	* configure.ac: Add detection of letter y support in assembler.
	* config.in: Regenerate.
	* configure: Regenerate.
	* output.h (SECTION_NOREAD): Add new bit flag.
	* varasm.c (default_elf_asm_named_section): Set y letter when we detect
	SECTION_NOREAD.
---
 gcc/config.in    |  6 ++++++
 gcc/configure    | 34 +++++++++++++++++++++++++++++++++-
 gcc/configure.ac |  6 ++++++
 gcc/output.h     |  3 ++-
 gcc/varasm.c     |  6 +++++-
 5 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 1796e1d..2aa2d1a 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1266,6 +1266,12 @@
 #endif
 
 
+/* Define if your assembler supports specifying the section flag y. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GAS_SECTION_NOREAD
+#endif
+
+
 /* Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.
    */
 #ifndef USED_FOR_TARGET
diff --git a/gcc/configure b/gcc/configure
index ff646e8..e543732 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -22365,7 +22365,6 @@ else
 $as_echo "$gcc_cv_readelf" >&6; }
 fi
 
-# Figure out what assembler alignment features are present.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler flags" >&5
 $as_echo_n "checking assembler flags... " >&6; }
 if test "${gcc_cv_as_flags+set}" = set; then :
@@ -22392,6 +22391,39 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_flags" >&5
 $as_echo "$gcc_cv_as_flags" >&6; }
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .section with y" >&5
+$as_echo_n "checking assembler for .section with y... " >&6; }
+if test "${gcc_cv_as_section_has_y+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcc_cv_as_section_has_y=no
+  if test x$gcc_cv_as != x; then
+    $as_echo '.section foo1,"y"
+.byte 0,0,0,0' > conftest.s
+    if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+    then
+	gcc_cv_as_section_has_y=yes
+    else
+      echo "configure: failed program was" >&5
+      cat conftest.s >&5
+    fi
+    rm -f conftest.o conftest.s
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_section_has_y" >&5
+$as_echo "$gcc_cv_as_section_has_y" >&6; }
+if test $gcc_cv_as_section_has_y = yes; then
+
+$as_echo "#define HAVE_GAS_SECTION_NOREAD 1" >>confdefs.h
+
+fi
+
+# Figure out what assembler alignment features are present.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .balign and .p2align" >&5
 $as_echo_n "checking assembler for .balign and .p2align... " >&6; }
 if test "${gcc_cv_as_balign_and_p2align+set}" = set; then :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 4dc7c10..d1717bf 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2446,6 +2446,12 @@ else
 	AC_MSG_RESULT($gcc_cv_readelf)
 fi
 
+gcc_GAS_CHECK_FEATURE([.section with y], gcc_cv_as_section_has_y,,,
+[.section foo1,"y"
+.byte 0,0,0,0],,
+[AC_DEFINE(HAVE_GAS_SECTION_NOREAD, 1,
+  [Define if your assembler supports specifying the section flag y.])])
+
 # Figure out what assembler alignment features are present.
 gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
  [2,6,0],,
diff --git a/gcc/output.h b/gcc/output.h
index 0924499..1df3088 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -381,7 +381,8 @@ extern void no_asm_to_stream (FILE *);
 #define SECTION_COMMON   0x800000	/* contains common data */
 #define SECTION_RELRO	 0x1000000	/* data is readonly after relocation processing */
 #define SECTION_EXCLUDE  0x2000000	/* discarded by the linker */
-#define SECTION_MACH_DEP 0x4000000	/* subsequent bits reserved for target */
+#define SECTION_NOREAD   0x4000000	/* section cannot be read but can be executed */
+#define SECTION_MACH_DEP 0x8000000	/* subsequent bits reserved for target */
 
 /* This SECTION_STYLE is used for unnamed sections that we can switch
    to using a special assembler directive.  */
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 3a3573e..c0499b1 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -6233,7 +6233,7 @@ void
 default_elf_asm_named_section (const char *name, unsigned int flags,
 			       tree decl)
 {
-  char flagchars[10], *f = flagchars;
+  char flagchars[11], *f = flagchars;
 
   /* If we have already declared this section, we can use an
      abbreviated form to switch back to it -- unless this section is
@@ -6266,6 +6266,10 @@ default_elf_asm_named_section (const char *name, unsigned int flags,
     *f++ = TLS_SECTION_ASM_FLAG;
   if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
     *f++ = 'G';
+#if defined (HAVE_GAS_SECTION_NOREAD) && HAVE_GAS_SECTION_NOREAD == 1
+  if (flags & SECTION_NOREAD)
+    *f++ = 'y';
+#endif
   *f = '\0';
 
   fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
-- 
2.7.0.rc3


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