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]

RFA: Check for .ref support on AIX


Olivier committed an AIX patch a few months ago to reduce the amount of
code and data pulled in (via EH tables) from C++ archives.  The patch
was a very welcome improvement on the behaviour of GCC 4.4 and earlier.

The patch coincided with the preparation of the binutils 2.20 release,
which was supposed to be the first version to support modern flavours
of AIX.  However, the EH patch relied on the .ref psuedo-op, which
binutils 2.20 unfortunately didn't support.

I'm about to post a binutils patch to add that support.  However,
now that 2.20 is out, I'd like GCC to use a configure check to make
sure that .ref is available.  If it isn't, I'd like it to fall back
to the 4.4 behaviour.

Tested on cross powerpc-ibm-aix6.1, both with and without the binutils
patch (and compared of course to the results without either patch).
The machine I used isn't set up for native testing.  OK to install?

Sorry that this patch is so late in the 4.5 cycle.

Richard


gcc/
	* configure.ac (HAVE_AS_REF): New C macro.
	* configure: Regenerate.
	* config.in: Likewise.
	* collect2.c (main): Only postpone SCAN_DWEH to the second pass
	if HAVE_AS_REF.
	* config/rs6000/aix.h (ASM_OUTPUT_DWARF_TABLE_REF): Only define
	if HAVE_AS_REF.

Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	2010-01-14 19:04:26.000000000 +0000
+++ gcc/configure.ac	2010-01-14 19:04:30.000000000 +0000
@@ -3326,6 +3326,21 @@ LCF0:
       [ bl __tls_get_addr(x@tlsgd)],,
       [AC_DEFINE(HAVE_AS_TLS_MARKERS, 1,
 	  [Define if your assembler supports arg info for __tls_get_addr.])])
+
+    case $target in
+      *-*-aix*)
+	gcc_GAS_CHECK_FEATURE([.ref support],
+	  gcc_cv_as_aix_ref, [2.21.0],,
+	  [	.csect stuff[[rw]]
+	     stuff:
+		.long 1
+		.extern sym
+		.ref sym
+	  ],,
+	  [AC_DEFINE(HAVE_AS_REF, 1,
+	    [Define if your assembler supports .ref])])
+	;;
+    esac
     ;;
 
   mips*-*-*)
Index: gcc/collect2.c
===================================================================
--- gcc/collect2.c	2010-01-14 19:04:26.000000000 +0000
+++ gcc/collect2.c	2010-01-14 19:04:30.000000000 +0000
@@ -1677,8 +1677,11 @@ main (int argc, char **argv)
        control whether we need a first pass link later on or not, and what
        will remain to be scanned there.  */
 
-    scanfilter this_filter
-      = shared_obj ? ld1_filter : (ld1_filter & ~SCAN_DWEH);
+    scanfilter this_filter = ld1_filter;
+#if HAVE_AS_REF
+    if (!shared_obj)
+      this_filter &= ~SCAN_DWEH;
+#endif
 
     while (export_object_lst < object)
       scan_prog_file (*export_object_lst++, PASS_OBJ, this_filter);
Index: gcc/config/rs6000/aix.h
===================================================================
--- gcc/config/rs6000/aix.h	2010-01-14 19:04:26.000000000 +0000
+++ gcc/config/rs6000/aix.h	2010-01-14 19:04:30.000000000 +0000
@@ -43,11 +43,13 @@ #define TARGET_IEEEQUAD 0
    collect has a chance to see them, so scan the object files directly.  */
 #define COLLECT_EXPORT_LIST
 
+#if HAVE_AS_REF
 /* Issue assembly directives that create a reference to the given DWARF table
    identifier label from the current function section.  This is defined to
    ensure we drag frame frame tables associated with needed function bodies in
    a link with garbage collection activated.  */
 #define ASM_OUTPUT_DWARF_TABLE_REF rs6000_aix_asm_output_dwarf_table_ref
+#endif
 
 /* Handle #pragma weak and #pragma pack.  */
 #define HANDLE_SYSV_PRAGMA 1


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