Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Aug 2012 06:24:22 GMT
From:      John Marino <draco@marino.st>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/170439: [MAINTAINER] lang/gcc-aux: Automatically add rpath to every created binary
Message-ID:  <201208070624.q776OMRd099009@red.freebsd.org>
Resent-Message-ID: <201208070630.q776U2wh091693@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         170439
>Category:       ports
>Synopsis:       [MAINTAINER] lang/gcc-aux: Automatically add rpath to every created binary
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 07 06:30:02 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     John Marino
>Release:        
>Organization:
>Environment:
>Description:
The gcc-aux compiler installs at /usr/local/gcc-aux, which means libraries such as libgcc_s.so and libstdc++.so are installed in the non-standard library location of /usr/local/gcc-aux/lib.

The accompanying patch updates the FreeBSD LINK_SPEC to automatically add an rpath to every generated dynamic binary that will point at this locate.  Without this running the binary would require the environment variable LD_LIBRARY_PATH would have to be set, or the path would have to be manual incorporated into the ld-elf.so.hints file by every user.

At the same time, --hash-style=both was added to LINK_SPEC of dynamic binaries.  This will allow faster symbol matching for dynamic linkers that support the tag (FreeBSD 10, FreeBSD 9.1+ (I think))

Files updated:
Makefile
files/diff-core
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- Makefile.orig
+++ Makefile
@@ -7,6 +7,7 @@

 PORTNAME=	gcc-aux
 PORTVERSION=	${SNAPSHOT}
+PORTREVISION=	1
 CATEGORIES=	lang
 MASTER_SITES=	http://downloads.dragonlace.net/src/:boot \
 		http://dragonlace.mirrors.ada.cx/src/:boot \
@@ -201,6 +202,12 @@ post-extract:
 	@${PATCH} -d ${WRKSRC} -s -E < ${FILESDIR}/diff-${suffix}
 .endfor

+	# Update LINK_SPEC to add gcc-aux lib runpath in every binary
+	@${ECHO} "Configuring LINK_SPEC runpath"
+	@perl -pi -e 's;\@PREFIX\@;${PREFIX};' \
+	  ${WRKSRC}/gcc/config/i386/freebsd64.h \
+	  ${WRKSRC}/gcc/config/i386/freebsd.h
+
 .if defined(WITH_STATIC)
 	@${ECHO} "Reconfiguring GCC Makefile to build compiler statically"
 	@${PATCH} -d ${WRKSRC} -s -E < ${FILESDIR}/diff-static-version
diff --git a/misc/package_source/freebsd/lang/gcc-aux/files/diff-core b/misc/package_source/freebsd/lang/gcc-aux/files/diff-core
index d30cff4..52fe216 100644
--- files/diff-core.orig
+++ files/diff-core
@@ -199,7 +199,7 @@
 +#define UINTPTR_TYPE      (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE)
 --- /dev/null
 +++ gcc/config/dragonfly.h
-@@ -0,0 +1,135 @@
+@@ -0,0 +1,136 @@
 +/* Base configuration file for all DragonFly targets.
 +   Copyright (C) 1999, 2000, 2001, 2007, 2008 Free Software Foundation, Inc.
 +
@@ -286,8 +286,9 @@
 +    %{rdynamic:-export-dynamic} \
 +    -dynamic-linker %(dfbsd_dynamic_linker) \
 +   } \
-+  %{static:-Bstatic}} \
-+  %{!static:--hash-style=both} \
++   %{static:-Bstatic} \
++  } \
++  %{!static:--hash-style=both -rpath @PREFIX@/gcc-aux/lib} \
 +  %{symbolic:-Bsymbolic}"
 +
 +#undef  LINK_SPEC
@@ -572,15 +573,41 @@
 +
 --- gcc/config/i386/freebsd.h.orig
 +++ gcc/config/i386/freebsd.h
-@@ -148,3 +148,5 @@
+@@ -102,6 +102,7 @@
+         %{rdynamic:-export-dynamic} \
+         -dynamic-linker %(fbsd_dynamic_linker) } \
+     %{static:-Bstatic}} \
++  %{!static:--hash-style=both -rpath @PREFIX@/gcc-aux/lib} \
+   %{symbolic:-Bsymbolic}"
+ 
+ /* A C statement to output to the stdio stream FILE an assembler
+@@ -148,3 +149,5 @@
  
  #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
  
 +/* Compile in __enable_execute_stack (void *) (see config.host) */
 +#define HAVE_ENABLE_EXECUTE_STACK
+--- gcc/config/i386/freebsd64.h.orig
++++ gcc/config/i386/freebsd64.h
+@@ -41,4 +41,5 @@
+         %{rdynamic:-export-dynamic} \
+ 	-dynamic-linker %(fbsd_dynamic_linker) } \
+     %{static:-Bstatic}} \
++  %{!static:--hash-style=both -rpath @PREFIX@/gcc-aux/lib} \
+   %{symbolic:-Bsymbolic}"
 --- gcc/config/i386/netbsd-elf.h.orig
 +++ gcc/config/i386/netbsd-elf.h
-@@ -119,3 +119,9 @@
+@@ -38,7 +38,8 @@
+ /* Provide a LINK_SPEC appropriate for a NetBSD/i386 ELF target.  */
+ 
+ #undef LINK_SPEC
+-#define LINK_SPEC NETBSD_LINK_SPEC_ELF
++#define LINK_SPEC NETBSD_LINK_SPEC_ELF \
++"%{!static:-rpath @PREFIX@/gcc-aux/lib}"
+ 
+ #define NETBSD_ENTRY_POINT "__start"
+ 
+@@ -119,3 +120,9 @@
  #define DEFAULT_PCC_STRUCT_RETURN 1
  
  #define HAVE_ENABLE_EXECUTE_STACK


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208070624.q776OMRd099009>