HPUX PA LINK_SPEC change (HP linker & shared libs)

ross.alexander@uk.neceur.com ross.alexander@uk.neceur.com
Tue Oct 1 09:00:00 GMT 2002


Steve,

Where do you the +Accept TypeMismatch from?
My copy of ld does like it at all.

/usr/ccs/bin/ld:
        HP aC++ B3910B A.03.30 Classic Iostream Library
        HP aC++ B3910B A.03.30 Language Support Library
        ld_msgs.cat: $Revision: 1.85 $
        92453-07 linker command s800.sgs ld PA64 B.11.32 REL 020412

Many thanks

Ross

---------------------------------------------------------------------------------

Ross Alexander                           "We demand clearly defined
MIS - NEC Europe Limited            boundaries of uncertainty and
Work ph: +44 20 8752 3394         doubt."


                                                                                                                                         
                      Steve Ellcey                                                                                                       
                      <sje@cup.hp.com>         To:       gcc-patches@gcc.gnu.org                                                         
                                               cc:       ross.alexander@uk.neceur.com                                                    
                      30/09/2002 20:49         Subject:  HPUX PA LINK_SPEC change (HP linker & shared libs)                              
                      Please respond to                                                                                                  
                      sje                                                                                                                
                                                                                                                                         
                                                                                                                                         




This patch allows GCC to be configured with the HP linker or the GNU
linker and to correctly build a shared library with either linker.
Currently it tries to pass -shared to the HP linker to build a shared
library and that does not work.

With this patch the default linker is set by configure and can be set
with --with-gnu-ld (or its opposite).  Regardless of the default the
user can specify the use of a different type of linker with -mgnu-ld or
-mno-gnu-ld.

When using the HP linker we also specify +Accept TypeMismatch on the
link line in order to get rid of ld warnings that cause test suite
failures.

Steve Ellcey
sje@cup.hp.com


2002-09-30  Steve Ellcey  <sje@cup.hp.com>

             * config.gcc (hppa*64*-*-hpux11*): Check gnu_ld.
             * config/pa/pa.h (MASK_GNU_LD): New.
             (TARGET_GNU_LD): New.
             (TARGET_SWITCHES): New gnu-ld & no-gnu-ld flags.
             * config/pa/pa64-hpux.h (LINK_SPEC): Set based
             on gnu-ld and MASK_GNU_LD.

*** gcc.orig/gcc/config.gcc          Mon Sep 30 10:27:43 2002
--- gcc/gcc/config.gcc         Mon Sep 30 12:22:53 2002
*************** hppa*64*-*-hpux11*)
*** 871,876 ****
--- 871,880 ----
             xmake_file="pa/x-ada"
             target_cpu_default="(MASK_PA_11|MASK_PA_20|MASK_GAS)"

+            if test x$gnu_ld = xyes
+            then
+                        target_cpu_default="${target_cpu_default}
|MASK_GNU_LD"
+            fi
  #          if [ x$enable_threads = x ]; then
  #              enable_threads=$have_pthread_h
  #          fi
*** gcc.orig/gcc/config/pa/pa.h            Mon Sep 30 10:28:06 2002
--- gcc/gcc/config/pa/pa.h           Mon Sep 30 12:24:28 2002
*************** extern int target_flags;
*** 150,155 ****
--- 150,161 ----
  #define TARGET_PA_20 (target_flags & MASK_PA_20)
  #endif

+ /* Assume GNU linker by default.  */
+ #define MASK_GNU_LD 8192
+ #ifndef TARGET_GNU_LD
+ #define TARGET_GNU_LD (target_flags & MASK_GNU_LD)
+ #endif
+
  /* Generate code for the HPPA 2.0 architecture in 64bit mode.  */
  #ifndef TARGET_64BIT
  #define TARGET_64BIT 0
*************** extern int target_flags;
*** 189,194 ****
--- 195,202 ----
     {"no-portable-runtime", -MASK_PORTABLE_RUNTIME, "Do not use portable
calling conventions"},\
     {"gas", MASK_GAS, "Assume code will be assembled by GAS"},
       \
     {"no-gas", -MASK_GAS, "Do not assume code will be assembled by GAS"},
                   \
+    {"gnu-ld", MASK_GNU_LD, "Assume code will be linked by GNU ld"}, \
+    {"no-gnu-ld", -MASK_GNU_LD, "Do not assume code will be linked by GNU
ld"},        \
     {"soft-float", MASK_SOFT_FLOAT, "Use software floating point"},
             \
     {"no-soft-float", -MASK_SOFT_FLOAT, "Do not use software floating
point"},           \
     {"long-load-store", MASK_LONG_LOAD_STORE, "Emit long load/store
sequences"},             \
*** gcc.orig/gcc/config/pa/pa64-hpux.h           Mon Sep 30 10:28:14 2002
--- gcc/gcc/config/pa/pa64-hpux.h          Mon Sep 30 12:26:07 2002
*************** Boston, MA 02111-1307, USA.  */
*** 22,29 ****
  /* We can debug dynamically linked executables on hpux11; we also
     want dereferencing of a NULL pointer to cause a SEGV.  */
  #undef LINK_SPEC
  #define LINK_SPEC \
!   "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:
-shared}"

  /* Like the default, except no -lg.  */
  #undef LIB_SPEC
--- 22,34 ----
  /* We can debug dynamically linked executables on hpux11; we also
     want dereferencing of a NULL pointer to cause a SEGV.  */
  #undef LINK_SPEC
+ #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
  #define LINK_SPEC \
!   "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive}
%{shared:%{mno-gnu-ld:-b}%{!mno-gnu-ld:-shared}} %{mno-gnu-ld:+Accept
TypeMismatch}"
! #else
! #define LINK_SPEC \
!   "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive}
%{shared:%{mgnu-ld:-shared}%{!mgnu-ld:-b}} %{!mgnu-ld:+Accept
TypeMismatch}"
! #endif

  /* Like the default, except no -lg.  */
  #undef LIB_SPEC







More information about the Gcc-patches mailing list