gcc/collect: Fixing Bug#815
cover gcc/collect: Fixing Bug#815
From: Lianhao Lu <[email protected]>
Added --sysroot support in the collect2 in gcc by adding --sysroot into COLLECT_GCC_OPTIONS. This allow the collect2 to pass --sysroot to ld or gcc it invokes.
Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: llu/gcc_collect
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=llu/gcc_collect
Thanks,
Lianhao Lu <[email protected]>
---
Lianhao Lu (1):
gcc/collect2: Added --sysroot support into collect2 in gcc.
meta/recipes-devtools/gcc/gcc-4.5.1.inc | 1 + .../gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch | 22 ++++++++++++++++++++ .../gcc/gcc-cross-canadian_4.5.1.bb | 2 +- .../gcc/gcc-cross-initial_4.5.1.bb | 2 +- .../gcc/gcc-cross-intermediate_4.5.1.bb | 2 +- meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb | 2 +- .../gcc/gcc-crosssdk-initial_4.5.1.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.5.1.bb | 2 +- meta/recipes-devtools/gcc/gcc_4.5.1.bb | 2 +- 11 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 meta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch
PATCH 1/1 gcc/collect2: Added --sysroot support into collect2 in gcc.
From: Lianhao Lu <[email protected]>
[YOCTO #815] Added --sysroot into COLLECT_GCC_OPTIONS to allow the collect2 support user specifed sysroot.
--- meta/recipes-devtools/gcc/gcc-4.5.1.inc | 1 + .../gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch | 22 ++++++++++++++++++++ .../gcc/gcc-cross-canadian_4.5.1.bb | 2 +- .../gcc/gcc-cross-initial_4.5.1.bb | 2 +- .../gcc/gcc-cross-intermediate_4.5.1.bb | 2 +- meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb | 2 +- .../gcc/gcc-crosssdk-initial_4.5.1.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.5.1.bb | 2 +- meta/recipes-devtools/gcc/gcc_4.5.1.bb | 2 +- 11 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 meta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch
meta/recipes-devtools/gcc/gcc-4.5.1.inc +1 -0
@@ -56,6 +56,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \ file://disable_relax_pic_calls_flag.patch \ file://gcc-poison-parameters.patch \ file://GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch \ + file://COLLECT_GCC_OPTIONS.patch \ " SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
meta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch new file +22 -0
@@ -0,0 +1,22 @@ +#This patck added --sysroot into COLLECT_GCC_OPTIONS which is used to +#invoke collect2. + +diff -ruN gcc-4.5.1.orig/gcc/gcc.c gcc-4.5.1/gcc/gcc.c +--- gcc-4.5.1.orig/gcc/gcc.c 2011-03-09 16:43:39.127752586 +0800 ++++ gcc-4.5.1/gcc/gcc.c 2011-03-09 16:47:15.894929459 +0800 +@@ -4667,6 +4667,15 @@ + sizeof ("COLLECT_GCC_OPTIONS=") - 1); + + first_time = TRUE; ++#ifdef HAVE_LD_SYSROOT ++ if (target_system_root_changed && target_system_root) ++ { ++ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1); ++ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root)); ++ obstack_grow (&collect_obstack, "'", 1); ++ first_time = FALSE; ++ } ++#endif + for (i = 0; (int) i < n_switches; i++) + { + const char *const *args;
meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb +1 -1
@@ -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"
meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb +1 -1
@@ -1,5 +1,5 @@ require gcc-cross_${PV}.bb require gcc-cross-initial.inc -PR = "r3" +PR = "r4"
meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb +1 -1
@@ -1,4 +1,4 @@ require gcc-cross_${PV}.bb require gcc-cross-intermediate.inc -PR = "r4" +PR = "r5"
meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb +1 -1
@@ -1,4 +1,4 @@ -PR = "r3" +PR = "r4" require gcc-${PV}.inc require gcc-cross4.inc
meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb +1 -1
@@ -1,4 +1,4 @@ require gcc-cross-initial_${PV}.bb require gcc-crosssdk-initial.inc -PR = "r3" +PR = "r4"
meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb +1 -1
@@ -1,4 +1,4 @@ require gcc-cross-intermediate_${PV}.bb require gcc-crosssdk-intermediate.inc -PR = "r3" +PR = "r4"
meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb +1 -1
@@ -1,4 +1,4 @@ require gcc-cross_${PV}.bb require gcc-crosssdk.inc -PR = "r3" +PR = "r4"
meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb +1 -1
@@ -1,4 +1,4 @@ -PR = "r2" +PR = "r3" require gcc-${PV}.inc require gcc-configure-runtime.inc
meta/recipes-devtools/gcc/gcc_4.5.1.bb +1 -1
@@ -1,4 +1,4 @@ -PR = "r3" +PR = "r4" require gcc-${PV}.inc require gcc-configure-target.inc require gcc-package-target.inc
Signature · 1 line
1.7.0.4
Re: [PATCH 1/1] gcc/collect2: Added --sysroot support into collect2 in gcc.
Looks fine to me.
Thanks,
Nitin
Quoted 190 lines
-----Original Message-----
From: [email protected] [mailto:poky- [email protected]] On Behalf Of Lianhao Lu
Sent: Wednesday, March 09, 2011 10:22 PM
To: [email protected]
Subject: [poky] [PATCH 1/1] gcc/collect2: Added --sysroot support into collect2 in gcc.From: Lianhao Lu <[email protected]>
[YOCTO #815] Added --sysroot into
COLLECT_GCC_OPTIONSto allow the collect2 support user specifed sysroot.Signed-off-by Lianhao Lu <[email protected]>--- meta/recipes-devtools/gcc/gcc-4.5.1.inc | 1 + .../gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch | 22 ++++++++++++++++++++ .../gcc/gcc-cross-canadian_4.5.1.bb | 2 +- .../gcc/gcc-cross-initial_4.5.1.bb | 2 +- .../gcc/gcc-cross-intermediate_4.5.1.bb | 2 +- meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb | 2 +- .../gcc/gcc-crosssdk-initial_4.5.1.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.5.1.bb | 2 +- meta/recipes-devtools/gcc/gcc_4.5.1.bb | 2 +- 11 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 meta/recipes-devtools/gcc/gcc-
4.5.1/COLLECT_GCC_OPTIONS.patchmeta/recipes- renamed from meta/recipes-devtools/gcc/gcc-4.5.1.inc +0
-0devtools/gcc/gcc-4.5.1.inc
index 6c600c1..3c4902e 100644meta/recipes-devtools/gcc/gcc-4.5.1.inc +1
-0@@ -56,6 +56,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc- ${PV}.tar.bz2 \ file://disable_relax_pic_calls_flag.patch \ file://gcc-poison-parameters.patch \ file://GPLUSPLUS_INCLUDE_DIR_with_sysroot.patch \ + file://COLLECT_GCC_OPTIONS.patch \ "
SRC_URI_append_sh3= " file://sh3-installfix-fixheaders.patch;patch=1
"(quoted diff) +0
-0
4.5.1/COLLECT_GCC_OPTIONS.patchb/meta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch
new file mode 100644
index 0000000..3e3dec7meta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch new file +14
-0@@ -0,0 +1,22 @@ +#This patck added --sysroot into COLLECT_GCC_OPTIONS which is used to +#invoke collect2. + +diff -ruN gcc-4.5.1.orig/gcc/gcc.c gcc-4.5.1/gcc/gcc.c +--- gcc-4.5.1.orig/gcc/gcc.c 2011-03-09 16:43:39.127752586 +0800 ++++ gcc-4.5.1/gcc/gcc.c 2011-03-09 16:47:15.894929459 +0800 +@@ -4667,6 +4667,15 @@ + sizeof ("COLLECT_GCC_OPTIONS=") - 1); + + first_time = TRUE; ++#ifdef HAVE_LD_SYSROOT ++ if (target_system_root_changed && target_system_root) ++ { ++ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
++obstack_grow(&collect_obstack,
target_system_root,strlen(target_system_root));
++obstack_grow(&collect_obstack, "'", 1);
++first_time= FALSE;
++ }
++#endifmeta/recipes-devtools/gcc/gcc-4.5.1/COLLECT_GCC_OPTIONS.patch new file +3
-0+ for (i = 0; (int) i < n_switches; i++) + { + const char *const *args;meta/recipes-devtools/gcc/gcc-cross-canadian_4.5.1.bb +1
-1@@ -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"meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb +1
-1@@ -1,5 +1,5 @@ require gcc-cross_${PV}.bb require gcc-cross-initial.inc -PR = "r3" +PR = "r4"meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb +1
-1@@ -1,4 +1,4 @@ require gcc-cross_${PV}.bb require gcc-cross-intermediate.inc -PR = "r4" +PR = "r5"meta/recipes-devtools/gcc/gcc-cross_4.5.1.bb +1
-1@@ -1,4 +1,4 @@ -PR = "r3" +PR = "r4" require gcc-${PV}.inc require gcc-cross4.incmeta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb +1
-1@@ -1,4 +1,4 @@ require gcc-cross-initial_${PV}.bb require gcc-crosssdk-initial.inc -PR = "r3" +PR = "r4"(quoted diff) +0
-0intermediate_4.5.1.bb b/meta/recipes-devtools/gcc/gcc-crosssdk- intermediate_4.5.1.bb
index 161d870..d235969 100644meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb +1
-1@@ -1,4 +1,4 @@ require gcc-cross-intermediate_${PV}.bb require gcc-crosssdk-intermediate.inc -PR = "r3" +PR = "r4"meta/recipes-devtools/gcc/gcc-crosssdk_4.5.1.bb +1
-1@@ -1,4 +1,4 @@ require gcc-cross_${PV}.bb require gcc-crosssdk.inc -PR = "r3" +PR = "r4"meta/recipes-devtools/gcc/gcc-runtime_4.5.1.bb +1
-1@@ -1,4 +1,4 @@ -PR = "r2" +PR = "r3" require gcc-${PV}.inc require gcc-configure-runtime.incmeta/recipes- renamed from meta/recipes-devtools/gcc/gcc_4.5.1.bb +0
-0devtools/gcc/gcc_4.5.1.bb
index 25e455c..a193b38 100644meta/recipes-devtools/gcc/gcc_4.5.1.bb +1
-2@@ -1,4 +1,4 @@ -PR = "r3" +PR = "r4" require gcc-${PV}.inc require gcc-configure-target.inc require gcc-package-target.inc --1.7.0.4
_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky
Re: [PATCH 1/1] gcc/collect2: Added --sysroot support into collect2 in gcc.
In reply to Lianhao LuQuoted 4 lines · Lianhao Lu
From: Lianhao Lu <[email protected]>
[YOCTO #815] Added --sysroot into
COLLECT_GCC_OPTIONSto allow the collect2 support user specifed sysroot.
interesting. What happens if you remove -frepo option while compiling your test program ?
Re: [PATCH 1/1] gcc/collect2: Added --sysroot support into collect2 in gcc.
Khem Raj wrote on 2011-03-11:
Quoted 8 lines · Lianhao Lu
Quoted 4 lines
From: Lianhao Lu <[email protected]>
[YOCTO #815] Added --sysroot into
COLLECT_GCC_OPTIONSto allow the collect2 support user specifed sysroot.interesting. What happens if you remove -frepo option while compiling your test program ?
By removing -frepo option, the problem seems gone. It seems that -frepo triggers the collect2 to recompile the object files which need template instantiations. By removing the -frepo the object files don't get recompiled, so the missing --sysroot wouldn't be a problem.
-Lianhao