Improve AIX/XLC support based on discussions with Jens Rehsack:

- Add cc_r/xlc_r wrapper using the same rules as xlc itself.
  It is used for example by Perl.
- Improve the RPATH emulation:
  - Always set -blibpath, use /usr/lib:/lib as default
  - If -blibpath is exlicitly given, add to the default
  - Additionally append any -Wl,-rpath given.
This commit is contained in:
joerg 2008-11-14 14:04:12 +00:00
parent 85423b6b31
commit 07e7458998
5 changed files with 71 additions and 17 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: xlc.mk,v 1.17 2008/02/07 20:59:05 rillig Exp $
# $NetBSD: xlc.mk,v 1.18 2008/11/14 14:04:12 joerg Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@ -82,6 +82,13 @@ _ALIASES.CXX= c++ xlc++
CXXPATH= ${XLCBASE}/bin/xlc++
PKG_CXX:= ${_XLC_CXX}
.endif
.if exists(${XLCBASE}/bin/xlc)
_XLC_VARS+= CC_R
_XLC_CC_R= ${_XLC_DIR}/bin/cc_r
_ALIASES.CC_R= cc_r xlc_r
CC_RPATH= ${XLCBASE}/bin/xlc_r
PKG_CC_R:= ${_XLC_CC_R}
.endif
_COMPILER_STRIP_VARS+= ${_XLC_VARS}
_COMPILER_RPATH_FLAG= -Wl,-R
_LINKER_RPATH_FLAG= -R

View file

@ -1,4 +1,4 @@
# $NetBSD: bsd.wrapper.mk,v 1.78 2008/11/06 21:34:16 joerg Exp $
# $NetBSD: bsd.wrapper.mk,v 1.79 2008/11/14 14:04:12 joerg Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@ -139,6 +139,11 @@ WRAPPEES+= IMAKE
.endif
WRAPPEES+= LD
.if !empty(PKGSRC_COMPILER:Mxlc) && ${OPSYS} == "AIX"
CC_R?= ${_XLC_DIR}/bin/cc_r
WRAPPEES+= CC_R
.endif
_WRAPPEE_UNIQUE_CMDS= # empty
.for _wrappee_ in ${WRAPPEES}
_WRAPPEES+= ${_wrappee_}
@ -283,6 +288,7 @@ _WRAP_TRANSFORM.CPP= ${_WRAP_TRANSFORM.CC}
.if !empty(PKGSRC_COMPILER:Mxlc)
. if ${OPSYS} == "AIX"
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-aix-xlc
_WRAP_CMD_SINK.CC_R= ${WRAPPER_TMPDIR}/cmd-sink-aix-xlc
_WRAP_CMD_SINK.CXX= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.LD= ${_WRAP_CMD_SINK.CC}
. elif ${OPSYS} == "Darwin"
@ -346,7 +352,9 @@ _WRAP_CMD_SINK.CC?= ${WRAPPER_TMPDIR}/cmd-sink-aix-cc
_WRAP_CMD_SINK.CXX?= ${_WRAP_CMD_SINK.CC}
_WRAP_CMD_SINK.LD?= ${WRAPPER_TMPDIR}/cmd-sink-aix-ld
_WRAP_CACHE_BODY.CC?= ${WRAPPER_TMPDIR}/cache-body-aix-cc
_WRAP_CACHE_BODY.CC_R?= ${WRAPPER_TMPDIR}/cache-body-aix-cc
_WRAP_TRANSFORM.CC?= ${WRAPPER_TMPDIR}/transform-aix-cc
_WRAP_TRANSFORM.CC_R?= ${WRAPPER_TMPDIR}/transform-aix-cc
_WRAP_CACHE_BODY.CXX?= ${_WRAP_CACHE_BODY.CC}
_WRAP_TRANSFORM.CXX?= ${_WRAP_TRANSFORM.CC}
.elif ${OPSYS} == "IRIX"

View file

@ -1,4 +1,4 @@
# $NetBSD: cmd-sink-aix-cc,v 1.2 2005/05/16 17:54:51 jlam Exp $
# $NetBSD: cmd-sink-aix-cc,v 1.3 2008/11/14 14:04:12 joerg Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@ -36,12 +36,23 @@
# Empty out the command buffer and build up the command line in $cmd.
blibpath=
orig_blibpath=
dynamic=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-aix-cc) pop: $arg"
case $arg in
-blibpath:*)
orig_blibpath=${arg#-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-ld) drop: $dir [setting orig_blibpath]"
dynamic=yes
;;
-Wl,-blibpath:*)
orig_blibpath=${arg#-Wl,-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-ld) drop: $dir [setting orig_blibpath]"
dynamic=yes
;;
##############################################################
# AIX ld(1) doesn't support -Wl,-rpath,* but accumulate them
# into a path collection we can later append to command line
@ -70,11 +81,15 @@ while ! queue_is_empty cmdbuf; do
done
# AIX ld(1) uses -blibpath to set the runtime library search path.
if $test -n "$blibpath"; then
arg="-Wl,-blibpath:/lib:/usr/lib:$blibpath"
$debug_log $wrapperlog " (cmd-sink-aix-cc) pop: $arg"
. $buildcmd
arg="-Wl,-blibpath:/usr/usr/lib:/lib"
if $test -n "$orig_blibpath"; then
arg="$arg:$orig_blibpath"
fi
if $test -n "$blibpath"; then
arg="$arg:$blibpath"
fi
$debug_log $wrapperlog " (cmd-sink-aix-cc) pop: $arg"
. $buildcmd
# If we are dynamically linking, make sure the runtime linker is used.
if $test -n "$dynamic"; then

View file

@ -1,4 +1,4 @@
# $NetBSD: cmd-sink-aix-ld,v 1.2 2005/05/16 17:54:51 jlam Exp $
# $NetBSD: cmd-sink-aix-ld,v 1.3 2008/11/14 14:04:12 joerg Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@ -35,6 +35,7 @@
# POSSIBILITY OF SUCH DAMAGE.
# Empty out the command buffer and build up the command line in $cmd.
orig_blibpath=
blibpath=
dynamic=
@ -42,6 +43,11 @@ while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-aix-ld) pop: $arg"
case $arg in
-blibpath:*)
orig_blibpath=${arg#-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-ld) drop: $dir [setting orig_blibpath]"
dynamic=yes
;;
##############################################################
# AIX ld(1) doesn't support -Wl,-rpath,* but accumulate them
# into a path collection we can later append to command line
@ -70,11 +76,15 @@ while ! queue_is_empty cmdbuf; do
done
# AIX ld(1) uses -blibpath to set the runtime library search path.
if $test -n "$blibpath"; then
arg="-blibpath:/lib:/usr/lib:$blibpath"
$debug_log $wrapperlog " (cmd-sink-aix-ld) pop: $arg"
. $buildcmd
arg="-blibpath:/usr/usr/lib:/lib"
if $test -n "$orig_blibpath"; then
arg="$arg:$orig_blibpath"
fi
if $test -n "$blibpath"; then
arg="$arg:$blibpath"
fi
$debug_log $wrapperlog " (cmd-sink-aix-ld) pop: $arg"
. $buildcmd
# If we are dynamically linking, make sure the runtime linker is used.
if $test -n "$dynamic"; then

View file

@ -1,4 +1,4 @@
# $NetBSD: cmd-sink-aix-xlc,v 1.4 2007/10/05 18:19:45 joerg Exp $
# $NetBSD: cmd-sink-aix-xlc,v 1.5 2008/11/14 14:04:12 joerg Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@ -36,10 +36,19 @@
# Empty out the command buffer and build up the command line in $cmd.
blibpath=
orig_blibpath=
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-aix-xlc) pop: $arg"
case $arg in
-blibpath:*)
orig_blibpath=${arg#-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-ld) drop: $dir [setting orig_blibpath]"
;;
-Wl,-blibpath:*)
orig_blibpath=${arg#-Wl,-blibpath:}
$debug_log $wrapperlog " (cmd-sink-aix-ld) drop: $dir [setting orig_blibpath]"
;;
##############################################################
# AIX xlC doesn't support -Wl,-rpath,* but accumulate them
# into a path collection we can later append to command line
@ -67,11 +76,16 @@ while ! queue_is_empty cmdbuf; do
done
# AIX xlc uses -blibpath to set the runtime library search path.
if $test -n "$blibpath"; then
arg="-blibpath:$blibpath"
$debug_log $wrapperlog " (cmd-sink-aix-xlc) pop: $arg"
. $buildcmd
arg="-Wl,-blibpath:/usr/usr/lib:/lib"
if $test -n "$orig_blibpath"; then
arg="$arg:$orig_blibpath"
fi
if $test -n "$blibpath"; then
arg="$arg:$blibpath"
fi
$debug_log $wrapperlog " (cmd-sink-aix-xlc) pop: $arg"
. $buildcmd
# Force dynamic linkage on AIX to get preference of dynamic libraries
# over library archives.
if $test "$dont_link" != "yes"; then