From a737f54ee5c079fee811f83bc1c02e824bd60dc0 Mon Sep 17 00:00:00 2001 From: dje Date: Fri, 7 Jan 2000 18:33:12 +0000 Subject: [PATCH] * rs6000.c (processor_target_table): Add power3 as alias for 630. * aix43.h: Revert Aug 2 change. (HAS_INIT_SECTION): Define, not visible yet. (LD_INIT_SWITCH): Define, not visible yet. * t-aix43 (MULTILIB_OPTIONS): Revert Aug 2 change. * glimits.h (__LONG_MAX__): Recognize 64-bit AIX too. * collect2.c (main): Expand ld2 size further. (export_object_lst): Cast assignment to avoid warning. (main, LD_INIT_SWITCH): Add AIX 4.2+ -binitfini support. (scan_prog_file, COFF): Do not collect initialization or finalization functions generated for entire shared object if init/fini support present. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31275 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 19 ++++++++++++++++++- gcc/collect2.c | 30 +++++++++++++++++++++++------- gcc/config/rs6000/aix43.h | 36 +++++++++++++++++++++++------------- gcc/config/rs6000/rs6000.c | 3 +++ gcc/config/rs6000/t-aix43 | 2 +- gcc/glimits.h | 2 +- 6 files changed, 69 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b730eea..103c9a5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2000-01-07 David Edelsohn + + * rs6000.c (processor_target_table): Add power3 as alias for 630. + * aix43.h: Revert Aug 2 change. + (HAS_INIT_SECTION): Define, not visible yet. + (LD_INIT_SWITCH): Define, not visible yet. + * t-aix43 (MULTILIB_OPTIONS): Revert Aug 2 change. + + * glimits.h (__LONG_MAX__): Recognize 64-bit AIX too. + + * collect2.c (main): Expand ld2 size further. + (export_object_lst): Cast assignment to avoid warning. + (main, LD_INIT_SWITCH): Add AIX 4.2+ -binitfini support. + (scan_prog_file, COFF): Do not collect initialization or + finalization functions generated for entire shared object if + init/fini support present. + 2000-01-07 Nick Clifton * config/elfos.h: Tidy up formatting of marcos. Make sure @@ -6,7 +23,7 @@ * config/svr4.h: Add #include "elfos.h" and remove duplicate definitions. -2000-01-07 Matt Austern +2000-01-07 Matt Austern * fold-const.c (real_hex_to_f): Remove duplicate declaration of expon. diff --git a/gcc/collect2.c b/gcc/collect2.c index bfab130..2fe3800 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -884,7 +884,7 @@ main (argc, argv) set first, in case a diagnostic is issued. */ ld1 = (const char **)(ld1_argv = (char **) xcalloc(sizeof (char *), argc+3)); - ld2 = (const char **)(ld2_argv = (char **) xcalloc(sizeof (char *), argc+6)); + ld2 = (const char **)(ld2_argv = (char **) xcalloc(sizeof (char *), argc+10)); object = (const char **)(object_lst = (char **) xcalloc(sizeof (char *), argc)); #ifdef DEBUG @@ -1263,7 +1263,7 @@ main (argc, argv) /* The AIX linker will discard static constructors in object files if nothing else in the file is referenced, so look at them first. */ { - char **export_object_lst = object_lst; + const char **export_object_lst = (const char **)object_lst; while (export_object_lst < object) scan_prog_file (*export_object_lst++, PASS_OBJ); @@ -1462,11 +1462,21 @@ main (argc, argv) /* Tell the linker that we have initializer and finalizer functions. */ #ifdef LD_INIT_SWITCH +#ifdef COLLECT_EXPORT_LIST + { + /* option name + functions + colons + NULL */ + char *buf = xmalloc (strlen (LD_INIT_SWITCH) + + strlen(initname) + strlen(fininame) + 3); + sprintf (buf, "%s:%s:%s", LD_INIT_SWITCH, initname, fininame); + *ld2++ = buf; + } +#else *ld2++ = LD_INIT_SWITCH; *ld2++ = initname; *ld2++ = LD_FINI_SWITCH; *ld2++ = fininame; #endif +#endif #ifdef COLLECT_EXPORT_LIST if (shared_obj) @@ -2786,7 +2796,8 @@ scan_prog_file (prog_name, which_pass) switch (is_ctor_dtor (name)) { case 1: - if (! is_shared) add_to_list (&constructors, name); + if (! is_shared) + add_to_list (&constructors, name); #ifdef COLLECT_EXPORT_LIST if (which_pass == PASS_OBJ) add_to_list (&exports, name); @@ -2801,7 +2812,8 @@ scan_prog_file (prog_name, which_pass) break; case 2: - if (! is_shared) add_to_list (&destructors, name); + if (! is_shared) + add_to_list (&destructors, name); #ifdef COLLECT_EXPORT_LIST if (which_pass == PASS_OBJ) add_to_list (&exports, name); @@ -2817,13 +2829,17 @@ scan_prog_file (prog_name, which_pass) #ifdef COLLECT_EXPORT_LIST case 3: +#ifndef LD_INIT_SWITCH if (is_shared) add_to_list (&constructors, name); +#endif break; case 4: +#ifndef LD_INIT_SWITCH if (is_shared) add_to_list (&destructors, name); +#endif break; #endif @@ -2841,7 +2857,8 @@ scan_prog_file (prog_name, which_pass) { if (which_pass == PASS_OBJ && (! export_flag)) add_to_list (&exports, name); - else if (! is_shared && which_pass == PASS_FIRST + else if (! is_shared + && which_pass == PASS_FIRST && import_flag && is_in_list(name, undefined.first)) add_to_list (&imports, name); @@ -2850,14 +2867,13 @@ scan_prog_file (prog_name, which_pass) continue; } -#if !defined(EXTENDED_COFF) if (debug) +#if !defined(EXTENDED_COFF) fprintf (stderr, "\tsec=%d class=%d type=%s%o %s\n", symbol.n_scnum, symbol.n_sclass, (symbol.n_type ? "0" : ""), symbol.n_type, name); #else - if (debug) fprintf (stderr, "\tiss = %5d, value = %5ld, index = %5d, name = %s\n", symbol.iss, (long) symbol.value, symbol.index, name); diff --git a/gcc/config/rs6000/aix43.h b/gcc/config/rs6000/aix43.h index 0653027..8b0c6fb 100644 --- a/gcc/config/rs6000/aix43.h +++ b/gcc/config/rs6000/aix43.h @@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA. */ #define TARGET_XL_CALL (target_flags & MASK_XL_CALL) #undef SUBTARGET_SWITCHES #define SUBTARGET_SWITCHES \ - {"64", MASK_64BIT | MASK_POWERPC64 | MASK_POWERPC}, \ - {"32", - (MASK_64BIT | MASK_POWERPC64)}, \ + {"aix64", MASK_64BIT | MASK_POWERPC64 | MASK_POWERPC}, \ + {"aix32", - (MASK_64BIT | MASK_POWERPC64)}, \ {"xl-call", MASK_XL_CALL}, \ {"no-xl-call", - MASK_XL_CALL}, \ {"threads", 0}, \ @@ -48,25 +48,25 @@ do { \ if (TARGET_64BIT && (target_flags & NON_POWERPC_MASKS)) \ { \ target_flags &= ~NON_POWERPC_MASKS; \ - warning ("-m64 and POWER architecture are incompatible."); \ + warning ("-maix64 and POWER architecture are incompatible."); \ } \ if (TARGET_64BIT && ! (target_flags & MASK_POWERPC64)) \ { \ target_flags |= MASK_POWERPC64; \ - warning ("-m64 requires PowerPC64 architecture remain enabled."); \ + warning ("-maix64 requires PowerPC64 architecture remain enabled."); \ } \ } while (0); #include "rs6000/rs6000.h" #undef ASM_SPEC -#define ASM_SPEC "-u %{m64:-a64 -mppc64} %(asm_cpu)" +#define ASM_SPEC "-u %{maix64:-a64 -mppc64} %(asm_cpu)" /* Common ASM definitions used by ASM_SPEC amonst the various targets for handling -mcpu=xxx switches. */ #undef ASM_CPU_SPEC #define ASM_CPU_SPEC \ -"%{!mcpu*: %{!m64: \ +"%{!mcpu*: %{!maix64: \ %{mpower: %{!mpower2: -mpwr}} \ %{mpower2: -mpwr2} \ %{mpowerpc*: %{!mpowerpc64: -mppc}} \ @@ -104,7 +104,7 @@ do { \ #undef CPP_SPEC #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\ - %{m64: -D__64BIT__ -D_ARCH_PPC}\ + %{maix64: -D__64BIT__ -D_ARCH_PPC}\ %{mpe: -I/usr/lpp/ppe.poe/include}\ %{mthreads: -D_THREAD_SAFE}\ %(cpp_cpu)" @@ -113,7 +113,7 @@ do { \ for handling -mcpu=xxx switches. */ #undef CPP_CPU_SPEC #define CPP_CPU_SPEC \ -"%{!mcpu*: %{!m64: \ +"%{!mcpu*: %{!maix64: \ %{mpower: %{!mpower2: -D_ARCH_PWR}} \ %{mpower2: -D_ARCH_PWR2} \ %{mpowerpc*: -D_ARCH_PPC} \ @@ -182,15 +182,15 @@ do { \ #undef LIB_SPEC #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\ %{p:-L/lib/profiled -L/usr/lib/profiled}\ - %{!m64:%{!shared:%{g*:-lg}}}\ + %{!maix64:%{!shared:%{g*:-lg}}}\ %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\ %{mthreads:-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\ %{!mthreads:-lc}" #undef LINK_SPEC #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\ - %{static:-bnso %(link_syscalls) } %{!m64:%{!shared:%{g*: %(link_libg) }}}\ - %{shared:-bM:SRE %{!e:-bnoentry}} %{m64:-b64}" + %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\ + %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}" #undef STARTFILE_SPEC #define STARTFILE_SPEC "%{!shared:\ @@ -198,8 +198,8 @@ do { \ %{!pg:%{p:/usr/lpp/ppe.poe/lib/mcrt0.o}\ %{!p:/usr/lpp/ppe.poe/lib/crt0.o}}}\ %{!mpe:\ - %{m64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ - %{!m64:\ + %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\ + %{!maix64:\ %{mthreads:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\ %{!mthreads:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}}" @@ -213,3 +213,13 @@ do { \ #undef RS6000_CALL_GLUE #define RS6000_CALL_GLUE "{cror 31,31,31|nop}" + +#if 0 +/* AIX 4.2 and above provides initialization and finalization function + support from linker command line. */ +#undef HAS_INIT_SECTION +#define HAS_INIT_SECTION + +#undef LD_INIT_SWITCH +#define LD_INIT_SWITCH "-binitfini" +#endif diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index a8db6d0..06f2a78 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -185,6 +185,9 @@ rs6000_override_options (default_cpu) {"power2", PROCESSOR_POWER, MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING, POWERPC_MASKS | MASK_NEW_MNEMONICS}, + {"power3", PROCESSOR_PPC630, + MASK_POWERPC | MASK_PPC_GFXOPT | MASK_NEW_MNEMONICS, + POWER_MASKS | MASK_PPC_GPOPT}, {"powerpc", PROCESSOR_POWERPC, MASK_POWERPC | MASK_NEW_MNEMONICS, POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64}, diff --git a/gcc/config/rs6000/t-aix43 b/gcc/config/rs6000/t-aix43 index 8897c56..2050700 100644 --- a/gcc/config/rs6000/t-aix43 +++ b/gcc/config/rs6000/t-aix43 @@ -18,7 +18,7 @@ fp-bit.c: $(srcdir)/config/fp-bit.c # different processor models MULTILIB_OPTIONS = msoft-float \ - mcpu=common/mcpu=power/mcpu=powerpc/m64 + mcpu=common/mcpu=power/mcpu=powerpc/maix64 MULTILIB_DIRNAMES = soft-float \ common power powerpc ppc64 diff --git a/gcc/glimits.h b/gcc/glimits.h index 93e7b8d..a766f81 100644 --- a/gcc/glimits.h +++ b/gcc/glimits.h @@ -64,7 +64,7 @@ /* Minimum and maximum values a `signed long int' can hold. (Same as `int'). */ #ifndef __LONG_MAX__ -#if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9) +#if defined (__alpha__) || (defined (_ARCH_PPC) && defined (__64BIT__)) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9) #define __LONG_MAX__ 9223372036854775807L #else #define __LONG_MAX__ 2147483647L -- 2.7.4