sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
[SM-Discuss] [PATCH] sorcery: added as_needed optimization option
- From: Remko van der Vossen <wich AT yuugen.jp>
- To: sm-discuss AT lists.ibiblio.org
- Subject: [SM-Discuss] [PATCH] sorcery: added as_needed optimization option
- Date: Sat, 22 Mar 2014 05:17:22 +0900
as_needed will add -Wl,--as-needed to LDFLAGS, which will cause the linker to
emit DT_NEEDED entries only for directly used libraries. This prevents
programs
and libraries that only indirectly depend on some library from breaking when
that library has an soname change. A scenario which is very common with
libtool
using build processes.
---
usr/sbin/sorcery | 4 +++-
var/lib/sorcery/modules/libsorcery | 7 ++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index 53bc512..c58f921 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -750,6 +750,7 @@ optimization_menu(){
local SPEEDY_HELP="Optimize generated code, conflicts with 'tiny'
(CFLAGS=$FAST)"
local STRIP_HELP="Remove all symbol table and relocation (debugging)
information (LDFLAGS=-s)"
local TINY_HELP="Optimize to smaller generated code, conflicts with
'speedy' (CFLAGS=$SMALL)"
+ local AS_NEEDED_HELP="Only emit DT_NEEDED entries for directly used
libraries (LDFLAGS=-Wl,--as-needed)"
if OPTIMIZATIONS=`eval $DIALOG ' --title "$OPT_TITLE" \
--no-cancel \
@@ -762,7 +763,8 @@ optimization_menu(){
"risky" " +speed" "$RISKY" "$RISKY_HELP" \
"speedy" " +size ++speed" "$SPEEDY" "$SPEEDY_HELP" \
"strip" " --size" "$STRIP" "$STRIP_HELP" \
- "tiny" " -size +speed" "$TINY" "$TINY_HELP"'`
+ "tiny" " -size +speed" "$TINY" "$TINY_HELP" \
+ "as_needed" "only direct libs" "$AS_NEEDED" "$AS_NEEDED_HELP"'`
then
OPTIMIZATIONS=`echo ${OPTIMIZATIONS} | tr '\n' ' '`
diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index 2abd865..c89f0ae 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -617,7 +617,7 @@ function optimize() {
debug "libsorcery" "In optimize()"
unset CFLAGS CXXFLAGS LDFLAGS CPPFLAGS
- unset FAST PRELINK RISKY SMALL SPEEDY STRIP TINY
+ unset FAST PRELINK RISKY SMALL SPEEDY STRIP TINY AS_NEEDED
# if user specified --no-opts then use only the args from the command line
# otherwise do the normal stuff
@@ -663,6 +663,11 @@ function optimize() {
TINY="on"
;;
+ as_needed)
+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
+ AS_NEEDED="on"
+ ;;
+
esac
done
# use echo to crunch all the whitespace out for broken configure scripts
--
1.9.0
-
[SM-Discuss] [PATCH] sorcery: added as_needed optimization option,
Remko van der Vossen, 03/21/2014
- Re: [SM-Discuss] [PATCH] sorcery: added as_needed optimization option, Paul Vinogradov, 03/23/2014
Archive powered by MHonArc 2.6.24.