Subject: GCC and RPATH on IRIX
To: None <tech-pkg@netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: tech-pkg
Date: 12/03/2006 18:23:41
Hi,

with PKGSRC_COMPILER=gcc on IRIX64 6.5 there were constantly warnings
like

	unknown flag R/path/to/lib (ignored)

Most stuff worked nonetheless, however ldd shows links into the pkgsrc working
object directory, so those will break as soon as I clean that. Others use only
base libraries in the default library path, so for those there wasn't a
problem.

GCC on IRIX still uses the native linker under the hood, so -R does not work.
The flag used by the MIPSPro compiler should be used for GCC as well. This
should not break anything unless someone uses GNU ld on IRIX, I think.

Are there any objections against the following change? 

Index: compiler/gcc.mk
===================================================================
RCS file: /pub/NetBSD-CVS/pkgsrc/mk/compiler/gcc.mk,v
retrieving revision 1.86
diff -u -p -r1.86 gcc.mk
--- compiler/gcc.mk	2 Dec 2006 22:32:59 -0000	1.86
+++ compiler/gcc.mk	3 Dec 2006 17:06:22 -0000
@@ -272,13 +272,13 @@ _NEED_NEWER_GCC!=	\
 PKG_SKIP_REASON=	"Unable to satisfy dependency: ${_GCC_DEPENDS}"
 .endif
 
-# GNU ld option used to set the rpath
-_LINKER_RPATH_FLAG=	-R
+.if !empty(MACHINE_ARCH:Mmips*)
+# MIPSPro linker option used to set the rpath.
+_LINKER_RPATH_FLAG=	-rpath
 
-# GCC passes rpath directives to the linker using "-Wl,-R".
-_COMPILER_RPATH_FLAG=	-Wl,${_LINKER_RPATH_FLAG}
+# MIPSPro passes rpath directives to the linker using "-Wl,-rpath,".
+_COMPILER_RPATH_FLAG=	-Wl,${_LINKER_RPATH_FLAG},
 
-.if !empty(MACHINE_ARCH:Mmips*)
 _COMPILER_ABI_FLAG.32=	-mabi=n32	# ABI == "32" == "n32"
 _COMPILER_ABI_FLAG.n32=	-mabi=n32
 _COMPILER_ABI_FLAG.o32=	-mabi=32
@@ -287,6 +287,14 @@ _COMPILER_ABI_FLAG.64=	-mabi=64
 .  if defined(ABI) && !empty(ABI)
 MABIFLAG=	${_COMPILER_ABI_FLAG.${ABI}}
 .  endif
+
+.else
+# GNU ld option used to set the rpath
+_LINKER_RPATH_FLAG=	-R
+
+# GCC passes rpath directives to the linker using "-Wl,-R".
+_COMPILER_RPATH_FLAG=	-Wl,${_LINKER_RPATH_FLAG}
+
 .endif
 
 .if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])

-- 
Christian