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] collect2 should ignore AIX shared objects marked F_LOADONLY


Although AIX now supports shared objects with the ".so" suffix, AIX's
native support for shared objects are special object files in archive
files.  Shared object versioning is supported with multiple shared
objects in a single archive file.  Shared object files providing
earlier versions of symbols normally have the F_LOADONLY flag set in
the header and only the most recent version is used for newly linked
applications.

Andrew Dixie pointed out that GCC collect2 is scanning all versions of
shared objects instead of only the ones that are set for new linking.

The patch below updates GCC_CHECK_HDR to skip object files marked F_LOADONLY.

Bootstrapped on powerpc-ibm-aix7.1.0.0

        * collect2.c (GCC_CHECK_HDR): Do not scan objects with F_LOADONLY
        flag set.

Index: collect2.c
===================================================================
--- collect2.c  (revision 195687)
+++ collect2.c  (working copy)
@@ -2763,12 +2763,14 @@
 /* 0757 = U803XTOCMAGIC (AIX 4.3) and 0767 = U64_TOCMAGIC (AIX V5) */
 #if TARGET_AIX_VERSION >= 51
 #   define GCC_CHECK_HDR(X) \
-     ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
-      || (HEADER (X).f_magic == 0767 && aix64_flag))
+     (((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
+       || (HEADER (X).f_magic == 0767 && aix64_flag)) \
+      && !(HEADER (X).f_flags & F_LOADONLY))
 #else
 #   define GCC_CHECK_HDR(X) \
-     ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
-      || (HEADER (X).f_magic == 0757 && aix64_flag))
+     (((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
+       || (HEADER (X).f_magic == 0757 && aix64_flag)) \
+      && !(HEADER (X).f_flags & F_LOADONLY))
 #endif

 #endif


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