Patchwork [PATCHv3,3/6] gcc: Statically link in support libraries e.g. libmpfr libgmp etc.

login
register
mail settings
Submitter Khem Raj
Date March 3, 2011, 6:52 a.m.
Message ID <1299135167-18330-4-git-send-email-raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/1055/
State Superseded
Headers show

Comments

Khem Raj - March 3, 2011, 6:52 a.m.
* This is helpful to get consistent behaviour with gcc on different
  hosts and linking the libraries in for cross gcc recipes should not
  be increasing the binary size alarmingly

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-configure-common.inc |    7 +++++++
 meta/recipes-devtools/gcc/gcc-configure-cross.inc  |   10 ++++++++++
 meta/recipes-devtools/gcc/gcc-configure-sdk.inc    |    8 ++++++++
 .../gcc/gcc-cross-canadian_4.3.3.bb                |    2 +-
 .../gcc/gcc-cross-canadian_4.5.1.bb                |    2 +-
 .../gcc/gcc-cross-initial_4.3.3.bb                 |    2 +-
 .../gcc/gcc-cross-initial_4.5.1.bb                 |    2 +-
 .../gcc/gcc-cross-intermediate_4.3.3.bb            |    2 +-
 .../gcc/gcc-cross-intermediate_4.5.1.bb            |    2 +-
 .../gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb   |    2 +-
 meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb       |    2 +-
 meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb       |    2 +-
 .../gcc/gcc-cross_csl-arm-2008q1.bb                |    2 +-
 .../gcc/gcc-crosssdk-initial_4.3.3.bb              |    2 +-
 .../gcc/gcc-crosssdk-initial_4.5.1.bb              |    2 +-
 .../gcc/gcc-crosssdk-intermediate_4.3.3.bb         |    2 +-
 .../gcc/gcc-crosssdk-intermediate_4.5.1.bb         |    2 +-
 meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb    |    2 +-
 meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb     |    2 +-
 meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb     |    2 +-
 meta/recipes-devtools/gcc/gcc_4.3.3.bb             |    2 +-
 meta/recipes-devtools/gcc/gcc_4.5.1.bb             |    2 +-
 meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb    |    2 +-
 meta/recipes-devtools/gcc/libgcc_4.5.1.bb          |    2 +-
 24 files changed, 46 insertions(+), 21 deletions(-)
Richard Purdie - March 8, 2011, 6:53 p.m.
On Mon, 2011-03-07 at 22:38 -0800, Khem Raj wrote:
> ping any opinion on this patch ?

This change looks rather hacky and I'd really like to understand more
about why this is needed and whether there is a better way we could
ensure the right flags get passed around. Can you provide more details
about whats going on with this. Obviously this change as it stands isn't
acceptable to upstream gcc and I'd like to see if we could find one that
was.

Cheers,

Richard

> On Wed, Mar 2, 2011 at 10:52 PM, Khem Raj <raj.khem@gmail.com> wrote:
> > * This is helpful to get consistent behaviour with gcc on different
> >  hosts and linking the libraries in for cross gcc recipes should not
> >  be increasing the binary size alarmingly
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/recipes-devtools/gcc/gcc-configure-common.inc |    7 +++++++
> >  meta/recipes-devtools/gcc/gcc-configure-cross.inc  |   10 ++++++++++
> >  meta/recipes-devtools/gcc/gcc-configure-sdk.inc    |    8 ++++++++
> >  .../gcc/gcc-cross-canadian_4.3.3.bb                |    2 +-
> >  .../gcc/gcc-cross-canadian_4.5.1.bb                |    2 +-
> >  .../gcc/gcc-cross-initial_4.3.3.bb                 |    2 +-
> >  .../gcc/gcc-cross-initial_4.5.1.bb                 |    2 +-
> >  .../gcc/gcc-cross-intermediate_4.3.3.bb            |    2 +-
> >  .../gcc/gcc-cross-intermediate_4.5.1.bb            |    2 +-
> >  .../gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb   |    2 +-
> >  meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb       |    2 +-
> >  meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb       |    2 +-
> >  .../gcc/gcc-cross_csl-arm-2008q1.bb                |    2 +-
> >  .../gcc/gcc-crosssdk-initial_4.3.3.bb              |    2 +-
> >  .../gcc/gcc-crosssdk-initial_4.5.1.bb              |    2 +-
> >  .../gcc/gcc-crosssdk-intermediate_4.3.3.bb         |    2 +-
> >  .../gcc/gcc-crosssdk-intermediate_4.5.1.bb         |    2 +-
> >  meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb    |    2 +-
> >  meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb     |    2 +-
> >  meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb     |    2 +-
> >  meta/recipes-devtools/gcc/gcc_4.3.3.bb             |    2 +-
> >  meta/recipes-devtools/gcc/gcc_4.5.1.bb             |    2 +-
> >  meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb    |    2 +-
> >  meta/recipes-devtools/gcc/libgcc_4.5.1.bb          |    2 +-
> >  24 files changed, 46 insertions(+), 21 deletions(-)
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
> > index 4393777..cdb69fb 100644
> > --- a/meta/recipes-devtools/gcc/gcc-configure-common.inc
> > +++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
> > @@ -85,6 +85,11 @@ do_configure () {
> >        export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
> >        export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
> >        export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
> > +
> > +        # Make sure LDFLAGS are honored.
> > +        sed -i 's/^LDFLAGS = $/LDFLAGS = @LDFLAGS@/' ${S}/Makefile.in
> > +        sed -i 's/^LDFLAGS = $/LDFLAGS = @LDFLAGS@/' ${S}/Makefile.tpl
> > +
> >        (cd ${S} && gnu-configize) || die "failure running gnu-configize"
> >
> >        # teach gcc to find correct target includedir when checking libc ssp support
> > @@ -108,5 +113,7 @@ do_configure () {
> >        echo "#endif /* ! GCC_DEFAULTS_H */" >> ${S}/gcc/defaults.h.new
> >        mv ${S}/gcc/defaults.h.new ${S}/gcc/defaults.h
> >        oe_runconf
> > +        # make sure that no @LDFLAG@ is left in the generated Makefile
> > +        sed -i "s/@LDFLAGS@//g" ${B}/Makefile
> >  }
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc-configure-cross.inc b/meta/recipes-devtools/gcc/gcc-configure-cross.inc
> > index 346d164..200cbe2 100644
> > --- a/meta/recipes-devtools/gcc/gcc-configure-cross.inc
> > +++ b/meta/recipes-devtools/gcc/gcc-configure-cross.inc
> > @@ -16,6 +16,16 @@ do_compile_prepend () {
> >        export LD_FOR_TARGET="${TARGET_SYS}-ld"
> >        export NM_FOR_TARGET="${TARGET_SYS}-nm"
> >        export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
> > +       export OBJDUMP_FOR_TARGET="${TARGET_SYS}-objdump"
> > +       export OBJCOPY_FOR_TARGET="${TARGET_SYS}-objcopy"
> > +       export STRIP_FOR_TARGET="${TARGET_SYS}-strip"
> > +       # Make sure we use GMP/MPFR statically
> > +       sed -i 's/^\(HOST_GMPLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
> > +       sed -i 's/^\(HOST_GMPLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
> > +       sed -i 's/^\(HOST_PPLLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
> > +       sed -i 's/^\(HOST_PPLLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
> > +       sed -i 's/^\(HOST_LIBELFLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
> > +       sed -i 's/^\(HOST_LIBELFLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
> >  }
> >
> >  LIBGCCS_VAR = "-lgcc_s"
> > diff --git a/meta/recipes-devtools/gcc/gcc-configure-sdk.inc b/meta/recipes-devtools/gcc/gcc-configure-sdk.inc
> > index 756e74e..3eb8992 100644
> > --- a/meta/recipes-devtools/gcc/gcc-configure-sdk.inc
> > +++ b/meta/recipes-devtools/gcc/gcc-configure-sdk.inc
> > @@ -39,6 +39,14 @@ do_configure () {
> >        export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
> >        export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
> >        export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
> > +       export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
> > +       # Make sure we use GMP/MPFR statically
> > +       sed -i 's/^\(HOST_GMPLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
> > +       sed -i 's/^\(HOST_GMPLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
> > +       sed -i 's/^\(HOST_PPLLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
> > +       sed -i 's/^\(HOST_PPLLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
> > +       sed -i 's/^\(HOST_LIBELFLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
> > +       sed -i 's/^\(HOST_LIBELFLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
> >        (cd ${S} && gnu-configize) || die "failure running gnu-configize"
> >        oe_runconf
> >  }
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.3.3.bb
> > index d420f80..8bf07d7 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.3.3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.3.3.bb
> > @@ -5,7 +5,7 @@ require gcc-cross-canadian.inc
> >  require gcc-configure-sdk.inc
> >  require gcc-package-sdk.inc
> >
> > -PR = "r20"
> > +PR = "r21"
> >
> >  DEPENDS += "gmp-nativesdk mpfr-nativesdk"
> >  RDEPENDS_${PN} += "mpfr-nativesdk"
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb
> > index 3eea4bc..92708d4 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb
> > @@ -5,7 +5,7 @@ require gcc-cross-canadian.inc
> >  require gcc-configure-sdk.inc
> >  require gcc-package-sdk.inc
> >
> > -PR = "r3"
> > +PR = "r4"
> >
> >  DEPENDS += "gmp-nativesdk mpfr-nativesdk libmpc-nativesdk elfutils-nativesdk"
> >  RDEPENDS_${PN} += "mpfr-nativesdk libmpc-nativesdk elfutils-nativesdk"
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb
> > index 28ac1ab..ef52845 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb
> > @@ -1,5 +1,5 @@
> >  require gcc-cross_${PV}.bb
> >  require gcc-cross-initial.inc
> >
> > -PR = "r5"
> > +PR = "r6"
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
> > index b2c257d..38e0964 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
> > @@ -1,5 +1,5 @@
> >  require gcc-cross_${PV}.bb
> >  require gcc-cross-initial.inc
> >
> > -PR = "r2"
> > +PR = "r3"
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb
> > index a8473b0..deeee37 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb
> > @@ -1,4 +1,4 @@
> >  require gcc-cross_${PV}.bb
> >  require gcc-cross-intermediate.inc
> > -PR = "r5"
> > +PR = "r6"
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
> > index e65d5df..9a30cb5 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
> > @@ -1,4 +1,4 @@
> >  require gcc-cross_${PV}.bb
> >  require gcc-cross-intermediate.inc
> > -PR = "r3"
> > +PR = "r4"
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb b/meta/recipes-devtools/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb
> > index 88e3842..462104f 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb
> > @@ -9,7 +9,7 @@ require gcc-cross-kernel.inc
> >
> >  DEFAULT_PREFERENCE = "-1"
> >
> > -PR = "r4"
> > +PR = "r5"
> >
> >  SRC_URI += "file://gcc-3.4.4-makefile-fix.patch;patch=1"
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb
> > index 5eaac5f..1a982f5 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb
> > @@ -1,4 +1,4 @@
> > -PR = "r17"
> > +PR = "r18"
> >
> >  require gcc-${PV}.inc
> >  require gcc-cross4.inc
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb
> > index 399cdf9..78bb05a 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb
> > @@ -1,4 +1,4 @@
> > -PR = "r2"
> > +PR = "r3"
> >
> >  require gcc-${PV}.inc
> >  require gcc-cross4.inc
> > diff --git a/meta/recipes-devtools/gcc/gcc-cross_csl-arm-2008q1.bb b/meta/recipes-devtools/gcc/gcc-cross_csl-arm-2008q1.bb
> > index 89534f1..0e7a1ee 100644
> > --- a/meta/recipes-devtools/gcc/gcc-cross_csl-arm-2008q1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-cross_csl-arm-2008q1.bb
> > @@ -1,4 +1,4 @@
> > -PR = "r5"
> > +PR = "r6"
> >
> >  require gcc-csl-arm-2008q1.inc
> >  require gcc-cross4.inc
> > diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb
> > index b42de47..d3ddcb1 100644
> > --- a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb
> > @@ -1,3 +1,3 @@
> >  require gcc-cross-initial_${PV}.bb
> >  require gcc-crosssdk-initial.inc
> > -PR = "r6"
> > +PR = "r7"
> > diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
> > index 240caf5..fec53b9 100644
> > --- a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
> > @@ -1,4 +1,4 @@
> >  require gcc-cross-initial_${PV}.bb
> >  require gcc-crosssdk-initial.inc
> >
> > -PR = "r2"
> > +PR = "r3"
> > diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb
> > index cd1f966..2be05f1 100644
> > --- a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb
> > @@ -1,3 +1,3 @@
> >  require gcc-cross-intermediate_${PV}.bb
> >  require gcc-crosssdk-intermediate.inc
> > -PR = "r8"
> > +PR = "r9"
> > diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
> > index a6653dd..161d870 100644
> > --- a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
> > @@ -1,4 +1,4 @@
> >  require gcc-cross-intermediate_${PV}.bb
> >  require gcc-crosssdk-intermediate.inc
> >
> > -PR = "r2"
> > +PR = "r3"
> > diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb
> > index 129e8d3..7069088 100644
> > --- a/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb
> > @@ -1,4 +1,4 @@
> >  require gcc-cross_${PV}.bb
> >  require gcc-crosssdk.inc
> >
> > -PR = "r2"
> > +PR = "r3"
> > diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb
> > index 99f927a..2f5cfb5 100644
> > --- a/meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb
> > @@ -1,4 +1,4 @@
> > -PR = "r18"
> > +PR = "r19"
> >
> >  require gcc-${PV}.inc
> >  require gcc-configure-runtime.inc
> > diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb
> > index 093f9bf..c1e680d 100644
> > --- a/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb
> > @@ -1,4 +1,4 @@
> > -PR = "r2"
> > +PR = "r3"
> >
> >  require gcc-${PV}.inc
> >  require gcc-configure-runtime.inc
> > diff --git a/meta/recipes-devtools/gcc/gcc_4.3.3.bb b/meta/recipes-devtools/gcc/gcc_4.3.3.bb
> > index f0471d4..ba6e7b2 100644
> > --- a/meta/recipes-devtools/gcc/gcc_4.3.3.bb
> > +++ b/meta/recipes-devtools/gcc/gcc_4.3.3.bb
> > @@ -1,4 +1,4 @@
> > -PR = "r11"
> > +PR = "r12"
> >
> >  require gcc-${PV}.inc
> >  require gcc-configure-target.inc
> > diff --git a/meta/recipes-devtools/gcc/gcc_4.5.1.bb b/meta/recipes-devtools/gcc/gcc_4.5.1.bb
> > index 919d4b0..25e455c 100644
> > --- a/meta/recipes-devtools/gcc/gcc_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc_4.5.1.bb
> > @@ -1,4 +1,4 @@
> > -PR = "r2"
> > +PR = "r3"
> >  require gcc-${PV}.inc
> >  require gcc-configure-target.inc
> >  require gcc-package-target.inc
> > diff --git a/meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb b/meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb
> > index cc7540a..2df12ef 100644
> > --- a/meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb
> > +++ b/meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb
> > @@ -1,4 +1,4 @@
> > -PR = "r3"
> > +PR = "r4"
> >
> >  require gcc-${PV}.inc
> >  require gcc-configure-target.inc
> > diff --git a/meta/recipes-devtools/gcc/libgcc_4.5.1.bb b/meta/recipes-devtools/gcc/libgcc_4.5.1.bb
> > index b6cf268..3f7ce0a 100644
> > --- a/meta/recipes-devtools/gcc/libgcc_4.5.1.bb
> > +++ b/meta/recipes-devtools/gcc/libgcc_4.5.1.bb
> > @@ -1,6 +1,6 @@
> >  require gcc-${PV}.inc
> >
> > -PR = "r0"
> > +PR = "r1"
> >
> >  INHIBIT_DEFAULT_DEPS = "1"
> >  DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
> > --
> > 1.7.4.1
> >
> >
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Richard Purdie - March 12, 2011, 12:50 p.m.
On Tue, 2011-03-08 at 11:04 -0800, Khem Raj wrote:
> On Tue, Mar 8, 2011 at 10:53 AM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > On Mon, 2011-03-07 at 22:38 -0800, Khem Raj wrote:
> >> ping any opinion on this patch ?
> >
> > This change looks rather hacky and I'd really like to understand more
> > about why this is needed and whether there is a better way we could
> > ensure the right flags get passed around. Can you provide more details
> > about whats going on with this. Obviously this change as it stands isn't
> > acceptable to upstream gcc and I'd like to see if we could find one that
> > was.
> 
> this is because the supporting libraries like mpc mpfr that are needed
> by gcc itself to run
> we might have different versions of these libraries. So depending upon
> shared objects
> would mean we need to find same shared objects where say the SDK is installed
> so either we ship the whole baggage or we link it in statically. This
> patch makes those libs to
> linked in statically and cross gcc wont have dependencies on these
> libs anymore so
> it can run on all hosts pretty much.

If you look at the way the SDK toolchain works in Poky, it automatically
ships the versions of these libraries that it needs so we don't actually
have this problem.

Also, looking at the patch again, was the first LDFLAGS change meant to
be in there, is that related or different to the shared/static
mpfr/mpc/gmp issue?

Cheers,

Richard
Tom Rini - March 14, 2011, 4:50 p.m.
On 03/12/2011 05:50 AM, Richard Purdie wrote:
> On Tue, 2011-03-08 at 11:04 -0800, Khem Raj wrote:
>> On Tue, Mar 8, 2011 at 10:53 AM, Richard Purdie
>> <richard.purdie@linuxfoundation.org>  wrote:
>>> On Mon, 2011-03-07 at 22:38 -0800, Khem Raj wrote:
>>>> ping any opinion on this patch ?
>>>
>>> This change looks rather hacky and I'd really like to understand more
>>> about why this is needed and whether there is a better way we could
>>> ensure the right flags get passed around. Can you provide more details
>>> about whats going on with this. Obviously this change as it stands isn't
>>> acceptable to upstream gcc and I'd like to see if we could find one that
>>> was.
>>
>> this is because the supporting libraries like mpc mpfr that are needed
>> by gcc itself to run
>> we might have different versions of these libraries. So depending upon
>> shared objects
>> would mean we need to find same shared objects where say the SDK is installed
>> so either we ship the whole baggage or we link it in statically. This
>> patch makes those libs to
>> linked in statically and cross gcc wont have dependencies on these
>> libs anymore so
>> it can run on all hosts pretty much.
>
> If you look at the way the SDK toolchain works in Poky, it automatically
> ships the versions of these libraries that it needs so we don't actually
> have this problem.
>
> Also, looking at the patch again, was the first LDFLAGS change meant to
> be in there, is that related or different to the shared/static
> mpfr/mpc/gmp issue?

I think it's time for someone to build one at dig at it, but are you 
sure they're used and shipped and not just used?  That was a problem 
before and unless the exported bits are using a relative $ORIGIN in the 
link path (or we've broken relocatability, which would be another 
problem) there's problems today.
Khem Raj - March 14, 2011, 5:52 p.m.
On Sat, Mar 12, 2011 at 4:50 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Tue, 2011-03-08 at 11:04 -0800, Khem Raj wrote:
>> On Tue, Mar 8, 2011 at 10:53 AM, Richard Purdie
>> <richard.purdie@linuxfoundation.org> wrote:
>> > On Mon, 2011-03-07 at 22:38 -0800, Khem Raj wrote:
>> >> ping any opinion on this patch ?
>> >
>> > This change looks rather hacky and I'd really like to understand more
>> > about why this is needed and whether there is a better way we could
>> > ensure the right flags get passed around. Can you provide more details
>> > about whats going on with this. Obviously this change as it stands isn't
>> > acceptable to upstream gcc and I'd like to see if we could find one that
>> > was.
>>
>> this is because the supporting libraries like mpc mpfr that are needed
>> by gcc itself to run
>> we might have different versions of these libraries. So depending upon
>> shared objects
>> would mean we need to find same shared objects where say the SDK is installed
>> so either we ship the whole baggage or we link it in statically. This
>> patch makes those libs to
>> linked in statically and cross gcc wont have dependencies on these
>> libs anymore so
>> it can run on all hosts pretty much.
>
> If you look at the way the SDK toolchain works in Poky, it automatically
> ships the versions of these libraries that it needs so we don't actually
> have this problem.
>

Yes thats one way of doing it and if you got it working this is fine
but there were issues when referencing
due to ORIGIN mucking. So this was better and cleaner than we link in
this libs into binary itself.  From
my POV even this solution can be improved by adding the support libs
to gcc build itself as sources
then we dont need to muck with gcc build configury at all. I have been
doing that for non OE related
SDKs and has been best so far.

> Also, looking at the patch again, was the first LDFLAGS change meant to
> be in there, is that related or different to the shared/static
> mpfr/mpc/gmp issue?

LDFLAGS are modified to get the LDFLAGS into gcc itself otherwise it
would not honour
the modified LDFLAGS to pass -static option.

>
> Cheers,
>
> Richard
>
>
Richard Purdie - March 14, 2011, 6:01 p.m.
On Mon, 2011-03-14 at 10:52 -0700, Khem Raj wrote:
> On Sat, Mar 12, 2011 at 4:50 AM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > If you look at the way the SDK toolchain works in Poky, it automatically
> > ships the versions of these libraries that it needs so we don't actually
> > have this problem.
> >
> 
> Yes thats one way of doing it and if you got it working this is fine
> but there were issues when referencing
> due to ORIGIN mucking. So this was better and cleaner than we link in
> this libs into binary itself.

The $ORIGIN stuff should be working just fine, have you checked this?

>   From
> my POV even this solution can be improved by adding the support libs
> to gcc build itself as sources
> then we dont need to muck with gcc build configury at all. I have been
> doing that for non OE related
> SDKs and has been best so far.

As I mention above, I do think we have a solution for this which is
working...

> > Also, looking at the patch again, was the first LDFLAGS change meant to
> > be in there, is that related or different to the shared/static
> > mpfr/mpc/gmp issue?
> 
> LDFLAGS are modified to get the LDFLAGS into gcc itself otherwise it
> would not honour
> the modified LDFLAGS to pass -static option.

Hmm, I'll look at the patch again as that didn't seem to be the only
LDFLAGS change but I could be wrong.

Cheers,

Richard
Khem Raj - March 14, 2011, 6:42 p.m.
On Mon, Mar 14, 2011 at 11:01 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Mon, 2011-03-14 at 10:52 -0700, Khem Raj wrote:
>> On Sat, Mar 12, 2011 at 4:50 AM, Richard Purdie
>> <richard.purdie@linuxfoundation.org> wrote:
>> > If you look at the way the SDK toolchain works in Poky, it automatically
>> > ships the versions of these libraries that it needs so we don't actually
>> > have this problem.
>> >
>>
>> Yes thats one way of doing it and if you got it working this is fine
>> but there were issues when referencing
>> due to ORIGIN mucking. So this was better and cleaner than we link in
>> this libs into binary itself.
>
> The $ORIGIN stuff should be working just fine, have you checked this?
>
>>   From
>> my POV even this solution can be improved by adding the support libs
>> to gcc build itself as sources
>> then we dont need to muck with gcc build configury at all. I have been
>> doing that for non OE related
>> SDKs and has been best so far.
>
> As I mention above, I do think we have a solution for this which is
> working...


OK I think then I should withdraw this patch.
Richard Purdie - March 14, 2011, 7:54 p.m.
On Mon, 2011-03-14 at 09:50 -0700, Tom Rini wrote:
> On 03/12/2011 05:50 AM, Richard Purdie wrote:
> > On Tue, 2011-03-08 at 11:04 -0800, Khem Raj wrote:
> >> On Tue, Mar 8, 2011 at 10:53 AM, Richard Purdie
> >> <richard.purdie@linuxfoundation.org>  wrote:
> >>> On Mon, 2011-03-07 at 22:38 -0800, Khem Raj wrote:
> >>>> ping any opinion on this patch ?
> >>>
> >>> This change looks rather hacky and I'd really like to understand more
> >>> about why this is needed and whether there is a better way we could
> >>> ensure the right flags get passed around. Can you provide more details
> >>> about whats going on with this. Obviously this change as it stands isn't
> >>> acceptable to upstream gcc and I'd like to see if we could find one that
> >>> was.
> >>
> >> this is because the supporting libraries like mpc mpfr that are needed
> >> by gcc itself to run
> >> we might have different versions of these libraries. So depending upon
> >> shared objects
> >> would mean we need to find same shared objects where say the SDK is installed
> >> so either we ship the whole baggage or we link it in statically. This
> >> patch makes those libs to
> >> linked in statically and cross gcc wont have dependencies on these
> >> libs anymore so
> >> it can run on all hosts pretty much.
> >
> > If you look at the way the SDK toolchain works in Poky, it automatically
> > ships the versions of these libraries that it needs so we don't actually
> > have this problem.
> >
> > Also, looking at the patch again, was the first LDFLAGS change meant to
> > be in there, is that related or different to the shared/static
> > mpfr/mpc/gmp issue?
> 
> I think it's time for someone to build one at dig at it, but are you 
> sure they're used and shipped and not just used?  That was a problem 
> before and unless the exported bits are using a relative $ORIGIN in the 
> link path (or we've broken relocatability, which would be another 
> problem) there's problems today.

They are used and shipped. As evidence I submit:

http://autobuilder.yoctoproject.org/nightly/20110311-1/toolchain/x86_64/poky-lsb-eglibc-x86_64-i586-toolchain-gmae-0.9+snapshot-20110313.tar.bz2

which I just inspected and it contains libmpc, libgmp and libmpfr.

If it doesn't work, I'd like someone to demonstrate the bug :)

Jsut to be clear, there is *one* hardcoded assumption in the way
nativesdk works which is to do with the dynamic loader location. If we
can link things against some generic common denominator ld.so (likely
from LSB?), it should be possible to remove that limitation. Its always
been intended to add that, just nobody has done it yet. 

Cheers,

Richard
Tom Rini - March 15, 2011, 5:33 p.m.
On 03/14/2011 12:54 PM, Richard Purdie wrote:
> On Mon, 2011-03-14 at 09:50 -0700, Tom Rini wrote:
>> On 03/12/2011 05:50 AM, Richard Purdie wrote:
>>> On Tue, 2011-03-08 at 11:04 -0800, Khem Raj wrote:
>>>> On Tue, Mar 8, 2011 at 10:53 AM, Richard Purdie
>>>> <richard.purdie@linuxfoundation.org>   wrote:
>>>>> On Mon, 2011-03-07 at 22:38 -0800, Khem Raj wrote:
>>>>>> ping any opinion on this patch ?
>>>>>
>>>>> This change looks rather hacky and I'd really like to understand more
>>>>> about why this is needed and whether there is a better way we could
>>>>> ensure the right flags get passed around. Can you provide more details
>>>>> about whats going on with this. Obviously this change as it stands isn't
>>>>> acceptable to upstream gcc and I'd like to see if we could find one that
>>>>> was.
>>>>
>>>> this is because the supporting libraries like mpc mpfr that are needed
>>>> by gcc itself to run
>>>> we might have different versions of these libraries. So depending upon
>>>> shared objects
>>>> would mean we need to find same shared objects where say the SDK is installed
>>>> so either we ship the whole baggage or we link it in statically. This
>>>> patch makes those libs to
>>>> linked in statically and cross gcc wont have dependencies on these
>>>> libs anymore so
>>>> it can run on all hosts pretty much.
>>>
>>> If you look at the way the SDK toolchain works in Poky, it automatically
>>> ships the versions of these libraries that it needs so we don't actually
>>> have this problem.
>>>
>>> Also, looking at the patch again, was the first LDFLAGS change meant to
>>> be in there, is that related or different to the shared/static
>>> mpfr/mpc/gmp issue?
>>
>> I think it's time for someone to build one at dig at it, but are you
>> sure they're used and shipped and not just used?  That was a problem
>> before and unless the exported bits are using a relative $ORIGIN in the
>> link path (or we've broken relocatability, which would be another
>> problem) there's problems today.
>
> They are used and shipped. As evidence I submit:
>
> http://autobuilder.yoctoproject.org/nightly/20110311-1/toolchain/x86_64/poky-lsb-eglibc-x86_64-i586-toolchain-gmae-0.9+snapshot-20110313.tar.bz2

Is 
/opt/poky-lsb/0.9+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-gcc 
the runs on host targets the target cross compiler the user should use 
now?  If so, you don't have relocation as the RPATH is hard-coded not 
$ORIGIN based.  If not, can I have a pointer to the right gcc to poke 
at?  Thanks :)
Richard Purdie - March 16, 2011, 1:27 p.m.
On Tue, 2011-03-15 at 10:33 -0700, Tom Rini wrote:
> On 03/14/2011 12:54 PM, Richard Purdie wrote:
> > On Mon, 2011-03-14 at 09:50 -0700, Tom Rini wrote:
> >> On 03/12/2011 05:50 AM, Richard Purdie wrote:
> >>> On Tue, 2011-03-08 at 11:04 -0800, Khem Raj wrote:
> >>>> On Tue, Mar 8, 2011 at 10:53 AM, Richard Purdie
> >>>> <richard.purdie@linuxfoundation.org>   wrote:
> >>>>> On Mon, 2011-03-07 at 22:38 -0800, Khem Raj wrote:
> >>>>>> ping any opinion on this patch ?
> >>>>>
> >>>>> This change looks rather hacky and I'd really like to understand more
> >>>>> about why this is needed and whether there is a better way we could
> >>>>> ensure the right flags get passed around. Can you provide more details
> >>>>> about whats going on with this. Obviously this change as it stands isn't
> >>>>> acceptable to upstream gcc and I'd like to see if we could find one that
> >>>>> was.
> >>>>
> >>>> this is because the supporting libraries like mpc mpfr that are needed
> >>>> by gcc itself to run
> >>>> we might have different versions of these libraries. So depending upon
> >>>> shared objects
> >>>> would mean we need to find same shared objects where say the SDK is installed
> >>>> so either we ship the whole baggage or we link it in statically. This
> >>>> patch makes those libs to
> >>>> linked in statically and cross gcc wont have dependencies on these
> >>>> libs anymore so
> >>>> it can run on all hosts pretty much.
> >>>
> >>> If you look at the way the SDK toolchain works in Poky, it automatically
> >>> ships the versions of these libraries that it needs so we don't actually
> >>> have this problem.
> >>>
> >>> Also, looking at the patch again, was the first LDFLAGS change meant to
> >>> be in there, is that related or different to the shared/static
> >>> mpfr/mpc/gmp issue?
> >>
> >> I think it's time for someone to build one at dig at it, but are you
> >> sure they're used and shipped and not just used?  That was a problem
> >> before and unless the exported bits are using a relative $ORIGIN in the
> >> link path (or we've broken relocatability, which would be another
> >> problem) there's problems today.
> >
> > They are used and shipped. As evidence I submit:
> >
> > http://autobuilder.yoctoproject.org/nightly/20110311-1/toolchain/x86_64/poky-lsb-eglibc-x86_64-i586-toolchain-gmae-0.9+snapshot-20110313.tar.bz2
> 
> Is 
> /opt/poky-lsb/0.9+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-gcc 
> the runs on host targets the target cross compiler the user should use 
> now?  If so, you don't have relocation as the RPATH is hard-coded not 
> $ORIGIN based.  If not, can I have a pointer to the right gcc to poke 
> at?  Thanks :)

Hmm, this sounds like something is not working with the relocation. I
could have sworn we'd made that relocatable :/.

It shouldn't be hard to fix with the relocation class at least...

I hope we at least agree it does find the right libraries to link
against which is most of the problem solved :)

Cheers,

Richard
Tom Rini - March 16, 2011, 5:17 p.m.
On 03/16/2011 06:27 AM, Richard Purdie wrote:
> On Tue, 2011-03-15 at 10:33 -0700, Tom Rini wrote:
>> On 03/14/2011 12:54 PM, Richard Purdie wrote:
>>> On Mon, 2011-03-14 at 09:50 -0700, Tom Rini wrote:
>>>> On 03/12/2011 05:50 AM, Richard Purdie wrote:
>>>>> On Tue, 2011-03-08 at 11:04 -0800, Khem Raj wrote:
>>>>>> On Tue, Mar 8, 2011 at 10:53 AM, Richard Purdie
>>>>>> <richard.purdie@linuxfoundation.org>    wrote:
>>>>>>> On Mon, 2011-03-07 at 22:38 -0800, Khem Raj wrote:
>>>>>>>> ping any opinion on this patch ?
>>>>>>>
>>>>>>> This change looks rather hacky and I'd really like to understand more
>>>>>>> about why this is needed and whether there is a better way we could
>>>>>>> ensure the right flags get passed around. Can you provide more details
>>>>>>> about whats going on with this. Obviously this change as it stands isn't
>>>>>>> acceptable to upstream gcc and I'd like to see if we could find one that
>>>>>>> was.
>>>>>>
>>>>>> this is because the supporting libraries like mpc mpfr that are needed
>>>>>> by gcc itself to run
>>>>>> we might have different versions of these libraries. So depending upon
>>>>>> shared objects
>>>>>> would mean we need to find same shared objects where say the SDK is installed
>>>>>> so either we ship the whole baggage or we link it in statically. This
>>>>>> patch makes those libs to
>>>>>> linked in statically and cross gcc wont have dependencies on these
>>>>>> libs anymore so
>>>>>> it can run on all hosts pretty much.
>>>>>
>>>>> If you look at the way the SDK toolchain works in Poky, it automatically
>>>>> ships the versions of these libraries that it needs so we don't actually
>>>>> have this problem.
>>>>>
>>>>> Also, looking at the patch again, was the first LDFLAGS change meant to
>>>>> be in there, is that related or different to the shared/static
>>>>> mpfr/mpc/gmp issue?
>>>>
>>>> I think it's time for someone to build one at dig at it, but are you
>>>> sure they're used and shipped and not just used?  That was a problem
>>>> before and unless the exported bits are using a relative $ORIGIN in the
>>>> link path (or we've broken relocatability, which would be another
>>>> problem) there's problems today.
>>>
>>> They are used and shipped. As evidence I submit:
>>>
>>> http://autobuilder.yoctoproject.org/nightly/20110311-1/toolchain/x86_64/poky-lsb-eglibc-x86_64-i586-toolchain-gmae-0.9+snapshot-20110313.tar.bz2
>>
>> Is
>> /opt/poky-lsb/0.9+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-gcc
>> the runs on host targets the target cross compiler the user should use
>> now?  If so, you don't have relocation as the RPATH is hard-coded not
>> $ORIGIN based.  If not, can I have a pointer to the right gcc to poke
>> at?  Thanks :)
>
> Hmm, this sounds like something is not working with the relocation. I
> could have sworn we'd made that relocatable :/.
>
> It shouldn't be hard to fix with the relocation class at least...

Yes, hopefully we just need to add relocatable to the various new 
classes and that'll be that.

Patch

diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
index 4393777..cdb69fb 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -85,6 +85,11 @@  do_configure () {
 	export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
 	export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
 	export ARCH_FLAGS_FOR_TARGET="${ARCH_FLAGS_FOR_TARGET}"
+
+        # Make sure LDFLAGS are honored.
+        sed -i 's/^LDFLAGS = $/LDFLAGS = @LDFLAGS@/' ${S}/Makefile.in
+        sed -i 's/^LDFLAGS = $/LDFLAGS = @LDFLAGS@/' ${S}/Makefile.tpl
+
 	(cd ${S} && gnu-configize) || die "failure running gnu-configize"
 	
 	# teach gcc to find correct target includedir when checking libc ssp support
@@ -108,5 +113,7 @@  do_configure () {
 	echo "#endif /* ! GCC_DEFAULTS_H */" >> ${S}/gcc/defaults.h.new
 	mv ${S}/gcc/defaults.h.new ${S}/gcc/defaults.h
 	oe_runconf
+        # make sure that no @LDFLAG@ is left in the generated Makefile
+        sed -i "s/@LDFLAGS@//g" ${B}/Makefile
 }
 
diff --git a/meta/recipes-devtools/gcc/gcc-configure-cross.inc b/meta/recipes-devtools/gcc/gcc-configure-cross.inc
index 346d164..200cbe2 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-cross.inc
@@ -16,6 +16,16 @@  do_compile_prepend () {
 	export LD_FOR_TARGET="${TARGET_SYS}-ld"
 	export NM_FOR_TARGET="${TARGET_SYS}-nm"
 	export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
+	export OBJDUMP_FOR_TARGET="${TARGET_SYS}-objdump"
+	export OBJCOPY_FOR_TARGET="${TARGET_SYS}-objcopy"
+	export STRIP_FOR_TARGET="${TARGET_SYS}-strip"
+	# Make sure we use GMP/MPFR statically
+	sed -i 's/^\(HOST_GMPLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
+	sed -i 's/^\(HOST_GMPLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
+	sed -i 's/^\(HOST_PPLLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
+	sed -i 's/^\(HOST_PPLLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
+	sed -i 's/^\(HOST_LIBELFLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
+	sed -i 's/^\(HOST_LIBELFLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
 }
 
 LIBGCCS_VAR = "-lgcc_s"
diff --git a/meta/recipes-devtools/gcc/gcc-configure-sdk.inc b/meta/recipes-devtools/gcc/gcc-configure-sdk.inc
index 756e74e..3eb8992 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-sdk.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-sdk.inc
@@ -39,6 +39,14 @@  do_configure () {
 	export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
 	export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
 	export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
+	export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc ${TARGET_CC_ARCH}"
+	# Make sure we use GMP/MPFR statically 
+	sed -i 's/^\(HOST_GMPLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
+	sed -i 's/^\(HOST_GMPLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
+	sed -i 's/^\(HOST_PPLLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl 
+	sed -i 's/^\(HOST_PPLLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
+	sed -i 's/^\(HOST_LIBELFLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.tpl
+	sed -i 's/^\(HOST_LIBELFLIBS =\) \(.*\)$/\1 -Wl,-Bstatic \2 -Wl,-Bdynamic/' ${S}/Makefile.in
 	(cd ${S} && gnu-configize) || die "failure running gnu-configize"
 	oe_runconf
 }
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.3.3.bb
index d420f80..8bf07d7 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.3.3.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.3.3.bb
@@ -5,7 +5,7 @@  require gcc-cross-canadian.inc
 require gcc-configure-sdk.inc
 require gcc-package-sdk.inc
 
-PR = "r20"
+PR = "r21"
 
 DEPENDS += "gmp-nativesdk mpfr-nativesdk"
 RDEPENDS_${PN} += "mpfr-nativesdk"
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb
index 3eea4bc..92708d4 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb
@@ -5,7 +5,7 @@  require gcc-cross-canadian.inc
 require gcc-configure-sdk.inc
 require gcc-package-sdk.inc
 
-PR = "r3"
+PR = "r4"
 
 DEPENDS += "gmp-nativesdk mpfr-nativesdk libmpc-nativesdk elfutils-nativesdk"
 RDEPENDS_${PN} += "mpfr-nativesdk libmpc-nativesdk elfutils-nativesdk"
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb
index 28ac1ab..ef52845 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb
@@ -1,5 +1,5 @@ 
 require gcc-cross_${PV}.bb
 require gcc-cross-initial.inc
 
-PR = "r5"
+PR = "r6"
 
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
index b2c257d..38e0964 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
@@ -1,5 +1,5 @@ 
 require gcc-cross_${PV}.bb
 require gcc-cross-initial.inc
 
-PR = "r2"
+PR = "r3"
 
diff --git a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb
index a8473b0..deeee37 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb
@@ -1,4 +1,4 @@ 
 require gcc-cross_${PV}.bb
 require gcc-cross-intermediate.inc
-PR = "r5"
+PR = "r6"
 
diff --git a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
index e65d5df..9a30cb5 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
@@ -1,4 +1,4 @@ 
 require gcc-cross_${PV}.bb
 require gcc-cross-intermediate.inc
-PR = "r3"
+PR = "r4"
 
diff --git a/meta/recipes-devtools/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb b/meta/recipes-devtools/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb
index 88e3842..462104f 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross-kernel-3.4.4_csl-arm-2005q3.bb
@@ -9,7 +9,7 @@  require gcc-cross-kernel.inc
 
 DEFAULT_PREFERENCE = "-1"
 
-PR = "r4"
+PR = "r5"
 
 SRC_URI += "file://gcc-3.4.4-makefile-fix.patch;patch=1"
 
diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb
index 5eaac5f..1a982f5 100644
--- a/meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross_4.3.3.bb
@@ -1,4 +1,4 @@ 
-PR = "r17"
+PR = "r18"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb
index 399cdf9..78bb05a 100644
--- a/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb
@@ -1,4 +1,4 @@ 
-PR = "r2"
+PR = "r3"
 
 require gcc-${PV}.inc
 require gcc-cross4.inc
diff --git a/meta/recipes-devtools/gcc/gcc-cross_csl-arm-2008q1.bb b/meta/recipes-devtools/gcc/gcc-cross_csl-arm-2008q1.bb
index 89534f1..0e7a1ee 100644
--- a/meta/recipes-devtools/gcc/gcc-cross_csl-arm-2008q1.bb
+++ b/meta/recipes-devtools/gcc/gcc-cross_csl-arm-2008q1.bb
@@ -1,4 +1,4 @@ 
-PR = "r5"
+PR = "r6"
 
 require gcc-csl-arm-2008q1.inc
 require gcc-cross4.inc
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb
index b42de47..d3ddcb1 100644
--- a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb
@@ -1,3 +1,3 @@ 
 require gcc-cross-initial_${PV}.bb
 require gcc-crosssdk-initial.inc
-PR = "r6"
+PR = "r7"
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
index 240caf5..fec53b9 100644
--- a/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
@@ -1,4 +1,4 @@ 
 require gcc-cross-initial_${PV}.bb
 require gcc-crosssdk-initial.inc
 
-PR = "r2"
+PR = "r3"
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb
index cd1f966..2be05f1 100644
--- a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb
@@ -1,3 +1,3 @@ 
 require gcc-cross-intermediate_${PV}.bb
 require gcc-crosssdk-intermediate.inc
-PR = "r8"
+PR = "r9"
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
index a6653dd..161d870 100644
--- a/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
@@ -1,4 +1,4 @@ 
 require gcc-cross-intermediate_${PV}.bb
 require gcc-crosssdk-intermediate.inc
 
-PR = "r2"
+PR = "r3"
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb
index 129e8d3..7069088 100644
--- a/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb
@@ -1,4 +1,4 @@ 
 require gcc-cross_${PV}.bb
 require gcc-crosssdk.inc
 
-PR = "r2"
+PR = "r3"
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb
index 99f927a..2f5cfb5 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb
+++ b/meta/recipes-devtools/gcc/gcc-runtime_4.3.3.bb
@@ -1,4 +1,4 @@ 
-PR = "r18"
+PR = "r19"
 
 require gcc-${PV}.inc
 require gcc-configure-runtime.inc
diff --git a/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb
index 093f9bf..c1e680d 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb
@@ -1,4 +1,4 @@ 
-PR = "r2"
+PR = "r3"
 
 require gcc-${PV}.inc
 require gcc-configure-runtime.inc
diff --git a/meta/recipes-devtools/gcc/gcc_4.3.3.bb b/meta/recipes-devtools/gcc/gcc_4.3.3.bb
index f0471d4..ba6e7b2 100644
--- a/meta/recipes-devtools/gcc/gcc_4.3.3.bb
+++ b/meta/recipes-devtools/gcc/gcc_4.3.3.bb
@@ -1,4 +1,4 @@ 
-PR = "r11"
+PR = "r12"
 
 require gcc-${PV}.inc
 require gcc-configure-target.inc
diff --git a/meta/recipes-devtools/gcc/gcc_4.5.1.bb b/meta/recipes-devtools/gcc/gcc_4.5.1.bb
index 919d4b0..25e455c 100644
--- a/meta/recipes-devtools/gcc/gcc_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/gcc_4.5.1.bb
@@ -1,4 +1,4 @@ 
-PR = "r2"
+PR = "r3"
 require gcc-${PV}.inc
 require gcc-configure-target.inc
 require gcc-package-target.inc
diff --git a/meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb b/meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb
index cc7540a..2df12ef 100644
--- a/meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb
+++ b/meta/recipes-devtools/gcc/gcc_csl-arm-2008q1.bb
@@ -1,4 +1,4 @@ 
-PR = "r3"
+PR = "r4"
 
 require gcc-${PV}.inc
 require gcc-configure-target.inc
diff --git a/meta/recipes-devtools/gcc/libgcc_4.5.1.bb b/meta/recipes-devtools/gcc/libgcc_4.5.1.bb
index b6cf268..3f7ce0a 100644
--- a/meta/recipes-devtools/gcc/libgcc_4.5.1.bb
+++ b/meta/recipes-devtools/gcc/libgcc_4.5.1.bb
@@ -1,6 +1,6 @@ 
 require gcc-${PV}.inc
 
-PR = "r0"
+PR = "r1"
 
 INHIBIT_DEFAULT_DEPS = "1"
 DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"