From 350f068eb5aa57d363b6c32a1b7811f98b3c4e18 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 15 Oct 2008 22:57:49 +0200 Subject: [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(-) create mode 100644 conf/distro/include/broken-as-needed.inc diff --git a/conf/bitbake.conf b/conf/bitbake.conf index e1dc3aa10a..d3abb1ef34 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 33349fcde1..df5dcbe47b 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 0c7fe5be49..2803762a6b 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 e68a23664b..f5cb1f2b3d 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 2ba21b20ad..2baeabd712 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 8993a6ae38..f60be254a7 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 0000000000..ea530f6078 --- /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 = "" -- cgit 1.2.3-korg