This patch enables COMDAT functionality on AIX. It defines MAKE_DECL_ONE_ONLY and removes the historical legacy link-line option of -bnodelcsect.
-bnodelcsect instructs the AIX (garbage collecting) linker to preserve un-referenced CSECTs (like ELF sections). In the distant past, GCC emitted code that produced necessary sections that appeared not to be referenced, and the linker deleted them. GCC bootstraps and shows similar testsuite results with the patch. At this point, the patch needs wider use to find any problems. I plan to install the patch shortly. Thanks, David Bootstrapped on powerpc-ibm-aix7.1.0.0 * config/rs6000/aix51.h (LINK_SPEC): Remove -bnodelcsect. * config/rs6000/aix52.h (LINK_SPEC): Same. * config/rs6000/aix53.h (LINK_SPEC): Same. * config/rs6000/aix61.h (LINK_SPEC): Same. * config/rs6000/xcoff.h (MAKE_DECL_ONE_ONLY): Define. Index: aix53.h =================================================================== --- aix53.h (revision 212454) +++ aix53.h (working copy) @@ -133,7 +133,7 @@ %{pthread:-lpthreads} -lc" #undef LINK_SPEC -#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ +#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro}\ %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\ %{mpe:-binitfini:poe_remote_main}" Index: aix51.h =================================================================== --- aix51.h (revision 212454) +++ aix51.h (working copy) @@ -121,7 +121,7 @@ %{pthread:-lpthreads} -lc" #undef LINK_SPEC -#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ +#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro}\ %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\ %{mpe:-binitfini:poe_remote_main}" Index: xcoff.h =================================================================== --- xcoff.h (revision 212454) +++ xcoff.h (working copy) @@ -309,3 +309,6 @@ than in the .eh_frame section. We do this because the AIX linker would otherwise garbage collect these sections. */ #define EH_FRAME_IN_DATA_SECTION 1 + +#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) + Index: aix52.h =================================================================== --- aix52.h (revision 212454) +++ aix52.h (working copy) @@ -133,7 +133,7 @@ %{pthread:-lpthreads} -lc" #undef LINK_SPEC -#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ +#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro}\ %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\ %{mpe:-binitfini:poe_remote_main}" Index: aix61.h =================================================================== --- aix61.h (revision 212454) +++ aix61.h (working copy) @@ -156,7 +156,7 @@ %{pthread:-lpthreads} -lc" #undef LINK_SPEC -#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ +#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro}\ %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\ %{mpe:-binitfini:poe_remote_main}"