[oe-commits] Holger Hans Peter Freyther : [link] Allow to use -Wl, --as-needed when linking (idea from poky)

GIT User account git at amethyst.openembedded.net
Wed Oct 15 21:13:51 UTC 2008


Module: openembedded.dev.git
Branch: holger/hash-style
Commit: 350f068eb5aa57d363b6c32a1b7811f98b3c4e18
URL:    http://gitweb.openembedded.net/?p=openembedded.dev.git&a=commit;h=350f068eb5aa57d363b6c32a1b7811f98b3c4e18

Author: Holger Hans Peter Freyther <zecke at selfish.org>
Date:   Wed Oct 15 22:57:49 2008 +0200

[link] Allow to use -Wl,--as-needed when linking (idea from poky)
    With --as-needed the linker will only emit SO_NEEDED for the libraries
    that are actually required and not the one given on the command line. This
    can drastically reduce the number of needed libraries.

    Sometimes this does not work and this is where broken-as-needed.inc will
    collect packages that do not work with --as-needed. The current list is
    taken from poky.

    Enable this for angstrom and eglibc, glibc and uclibc as this requires a
    binutils version from around ~2006. Also bump the DISTRO_PR after this change.

---

 conf/bitbake.conf                                  |    3 ++-
 conf/distro/angstrom-2008.1.conf                   |    1 +
 conf/distro/include/angstrom-2007-for-openmoko.inc |    1 +
 conf/distro/include/angstrom-eglibc.inc            |    4 +++-
 conf/distro/include/angstrom-glibc.inc             |    4 +++-
 conf/distro/include/angstrom-uclibc.inc            |    3 +++
 conf/distro/include/broken-as-needed.inc           |   10 ++++++++++
 7 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index e1dc3aa..d3abb1e 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -404,7 +404,8 @@ export LDFLAGS = "${TARGET_LDFLAGS}"
 export TARGET_LDFLAGS = "-L${STAGING_DIR_TARGET}${layout_libdir} \
                          -Wl,-rpath-link,${STAGING_DIR_TARGET}${layout_libdir} \
                          -Wl,-O1 \
-                         ${TARGET_LINK_HASH_STYLE} "
+                         ${TARGET_LINK_HASH_STYLE} \
+                         ${TARGET_ASNEEDED} "
 
 # Which flags to leave by strip-flags() in bin/build/oebuild.sh ?
 ALLOWED_FLAGS = "-O -mcpu -march -pipe"
diff --git a/conf/distro/angstrom-2008.1.conf b/conf/distro/angstrom-2008.1.conf
index 33349fc..df5dcbe 100644
--- a/conf/distro/angstrom-2008.1.conf
+++ b/conf/distro/angstrom-2008.1.conf
@@ -27,6 +27,7 @@ require conf/distro/include/sane-srcdates.inc
 require conf/distro/include/sane-srcrevs.inc
 require conf/distro/include/angstrom-2008-preferred-versions.inc
 require conf/distro/include/preferred-opie-versions-1.2.4.inc
+require conf/distro/include/broken-as-needed.inc
 
 #Images built can have to modes:
 # 'debug': empty rootpassword, strace included
diff --git a/conf/distro/include/angstrom-2007-for-openmoko.inc b/conf/distro/include/angstrom-2007-for-openmoko.inc
index 0c7fe5b..2803762 100644
--- a/conf/distro/include/angstrom-2007-for-openmoko.inc
+++ b/conf/distro/include/angstrom-2007-for-openmoko.inc
@@ -11,6 +11,7 @@ DISTRO_REVISION = "51"
 
 require conf/distro/include/sane-srcdates.inc
 require conf/distro/include/sane-srcrevs.inc
+require conf/distro/include/broken-as-needed.inc
 
 #Images built can have to modes:
 # 'debug': empty rootpassword, strace included
diff --git a/conf/distro/include/angstrom-eglibc.inc b/conf/distro/include/angstrom-eglibc.inc
index e68a236..f5cb1f2 100644
--- a/conf/distro/include/angstrom-eglibc.inc
+++ b/conf/distro/include/angstrom-eglibc.inc
@@ -30,7 +30,9 @@ BUILD_OPTIMIZATION_pn-perl = "-O1"
 BUILD_OPTIMIZATION_sparc = "-O2"
 
 TARGET_LINK_HASH_STYLE = "-Wl,--hash-style=gnu"
-DISTRO_PR = ".1"
+TARGET_ASNEEDED = "-Wl,--as-needed"
+
+DISTRO_PR = ".2"
 
 CXXFLAGS += "-fvisibility-inlines-hidden"
 
diff --git a/conf/distro/include/angstrom-glibc.inc b/conf/distro/include/angstrom-glibc.inc
index 2ba21b2..2baeabd 100644
--- a/conf/distro/include/angstrom-glibc.inc
+++ b/conf/distro/include/angstrom-glibc.inc
@@ -34,7 +34,9 @@ BUILD_OPTIMIZATION_pn-glibc = "-O2"
 BUILD_OPTIMIZATION_sparc = "-O2"
 
 TARGET_LINK_HASH_STYLE = "-Wl,--hash-style=gnu"
-DISTRO_PR = ".1"
+TARGET_ASNEEDED = "-Wl,--as-needed"
+
+DISTRO_PR = ".2"
 
 CXXFLAGS += "-fvisibility-inlines-hidden"
 
diff --git a/conf/distro/include/angstrom-uclibc.inc b/conf/distro/include/angstrom-uclibc.inc
index 8993a6a..f60be25 100644
--- a/conf/distro/include/angstrom-uclibc.inc
+++ b/conf/distro/include/angstrom-uclibc.inc
@@ -32,6 +32,9 @@ BUILD_OPTIMIZATION = "-Os"
 #Note that this testing was done without the gcc-pr32889.patch.
 FULL_OPTIMIZATION_avr32 = "-Os -fomit-frame-pointer"
 
+TARGET_ASNEEDED = "-Wl,--as-needed"
+
+DISTRO_PR = ".1"
 
 CXXFLAGS += "-fvisibility-inlines-hidden"
 
diff --git a/conf/distro/include/broken-as-needed.inc b/conf/distro/include/broken-as-needed.inc
new file mode 100644
index 0000000..ea530f6
--- /dev/null
+++ b/conf/distro/include/broken-as-needed.inc
@@ -0,0 +1,10 @@
+# Packages that break when trying to link with --as-needed
+TARGET_ASNEEDED_pn-console-tools = ""
+TARGET_ASNEEDED_pn-dialer = ""
+TARGET_ASNEEDED_pn-distcc = ""
+TARGET_ASNEEDED_pn-icu = ""
+TARGET_ASNEEDED_pn-minimo = ""
+TARGET_ASNEEDED_pn-openobex = ""
+TARGET_ASNEEDED_pn-pciutils = ""
+TARGET_ASNEEDED_pn-puzzles = ""
+TARGET_ASNEEDED_pn-xserver-kdrive-xomap = ""





More information about the Openembedded-commits mailing list