All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-initramfs][PATCH] klibc: klcc: consider --sysroot option and override gcc-cross encoded sysroot
@ 2014-09-01 22:15 Andrea Adami
  2014-09-04 19:57 ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Andrea Adami @ 2014-09-01 22:15 UTC (permalink / raw)
  To: openembedded-devel

For the recipes built with klcc-cross it is necessary to
pass --sysroot otherwise we default to the one encoded in gcc-cross which
actually is the 'first one' built.
The issue was revealed when building for armv4 after having built for armv5te:
the produced binaries did contain Illegal Instruction (bx lr).

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 meta-initramfs/classes/klibc.bbclass                       |  4 ++--
 .../klibc/klibc-2.0.4/klcc-consider-sysroot.patch          | 14 ++++++++++++++
 meta-initramfs/recipes-devtools/klibc/klibc.inc            |  1 +
 3 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch

diff --git a/meta-initramfs/classes/klibc.bbclass b/meta-initramfs/classes/klibc.bbclass
index ca741cd..8690472 100644
--- a/meta-initramfs/classes/klibc.bbclass
+++ b/meta-initramfs/classes/klibc.bbclass
@@ -4,8 +4,8 @@ DEPENDS =+ "klcc-cross"
 # Default for klcc is to build static binaries.
 # Set CC = "${TARGET_PREFIX}klcc -shared" to build the dynamic version.
 
-export CC = "${TARGET_PREFIX}klcc"
-export CC_armv4_linux-gnueabi = "${TARGET_PREFIX}klcc -march=armv4 -mthumb-interwork"
+export CC = "${TARGET_PREFIX}klcc --sysroot=${STAGING_DIR_TARGET}"
+export CC_armv4_linux-gnueabi = "${TARGET_PREFIX}klcc --sysroot=${STAGING_DIR_TARGET} -march=armv4 -mthumb-interwork"
 
 export CPP = "${CC} -E"
 
diff --git a/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
new file mode 100644
index 0000000..9bc4835
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
@@ -0,0 +1,14 @@
+diff --git a/klcc/klcc.in b/klcc/klcc.in
+index 43d0984..61e9385 100644
+--- a/klcc/klcc.in
++++ b/klcc/klcc.in
+@@ -204,6 +204,9 @@ while ( defined($a = shift(@ARGV)) ) {
+ 	# Libraries
+ 	push(@libs, $a);
+ 	push(@libs, shift(@ARGV)) if ( $2 eq '' );
++    } elsif ( $a =~ /^--([sysroot=])(.*)$/ ) {
++	# Override gcc encoded sysroot
++	push(@ccopt, $a);
+     } else {
+ 	die "$0: unknown option: $a\n";
+     }
diff --git a/meta-initramfs/recipes-devtools/klibc/klibc.inc b/meta-initramfs/recipes-devtools/klibc/klibc.inc
index 0209b20..f3e9972 100644
--- a/meta-initramfs/recipes-devtools/klibc/klibc.inc
+++ b/meta-initramfs/recipes-devtools/klibc/klibc.inc
@@ -16,6 +16,7 @@ SRC_URI_append_linux-uclibceabi = " file://klibc-config-eabi.patch \
                                     "
 SRC_URI += "file://klibc-linux-libc-dev.patch \
             file://staging.patch \
+            file://klcc-consider-sysroot.patch \
             "
 
 S = "${WORKDIR}/git"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [meta-initramfs][PATCH] klibc: klcc: consider --sysroot option and override gcc-cross encoded sysroot
  2014-09-01 22:15 [meta-initramfs][PATCH] klibc: klcc: consider --sysroot option and override gcc-cross encoded sysroot Andrea Adami
@ 2014-09-04 19:57 ` Khem Raj
  2014-09-16 19:04   ` Andrea Adami
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2014-09-04 19:57 UTC (permalink / raw)
  To: openembedded-devel

On Monday, September 1, 2014, Andrea Adami <andrea.adami@gmail.com> wrote:

> For the recipes built with klcc-cross it is necessary to
> pass --sysroot otherwise we default to the one encoded in gcc-cross which
> actually is the 'first one' built.
> The issue was revealed when building for armv4 after having built for
> armv5te:
> the produced binaries did contain Illegal Instruction (bx lr).
>
> Signed-off-by: Andrea Adami <andrea.adami@gmail.com <javascript:;>>
> ---
>  meta-initramfs/classes/klibc.bbclass                       |  4 ++--
>  .../klibc/klibc-2.0.4/klcc-consider-sysroot.patch          | 14
> ++++++++++++++
>  meta-initramfs/recipes-devtools/klibc/klibc.inc            |  1 +
>  3 files changed, 17 insertions(+), 2 deletions(-)
>  create mode 100644
> meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
>
> diff --git a/meta-initramfs/classes/klibc.bbclass
> b/meta-initramfs/classes/klibc.bbclass
> index ca741cd..8690472 100644
> --- a/meta-initramfs/classes/klibc.bbclass
> +++ b/meta-initramfs/classes/klibc.bbclass
> @@ -4,8 +4,8 @@ DEPENDS =+ "klcc-cross"
>  # Default for klcc is to build static binaries.
>  # Set CC = "${TARGET_PREFIX}klcc -shared" to build the dynamic version.
>
> -export CC = "${TARGET_PREFIX}klcc"
> -export CC_armv4_linux-gnueabi = "${TARGET_PREFIX}klcc -march=armv4
> -mthumb-interwork"
> +export CC = "${TARGET_PREFIX}klcc --sysroot=${STAGING_DIR_TARGET}"
> +export CC_armv4_linux-gnueabi = "${TARGET_PREFIX}klcc
> --sysroot=${STAGING_DIR_TARGET} -march=armv4 -mthumb-interwork"
>
> May be you can use TOOLCHAIN_OPTIONS
here


 export CPP = "${CC} -E"
>
> diff --git
> a/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
> b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
> new file mode 100644
> index 0000000..9bc4835
> --- /dev/null
> +++
> b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
> @@ -0,0 +1,14 @@
> +diff --git a/klcc/klcc.in b/klcc/klcc.in
> +index 43d0984..61e9385 100644
> +--- a/klcc/klcc.in
> ++++ b/klcc/klcc.in
> +@@ -204,6 +204,9 @@ while ( defined($a = shift(@ARGV)) ) {
> +       # Libraries
> +       push(@libs, $a);
> +       push(@libs, shift(@ARGV)) if ( $2 eq '' );
> ++    } elsif ( $a =~ /^--([sysroot=])(.*)$/ ) {
> ++      # Override gcc encoded sysroot
> ++      push(@ccopt, $a);
> +     } else {
> +       die "$0: unknown option: $a\n";
> +     }
> diff --git a/meta-initramfs/recipes-devtools/klibc/klibc.inc
> b/meta-initramfs/recipes-devtools/klibc/klibc.inc
> index 0209b20..f3e9972 100644
> --- a/meta-initramfs/recipes-devtools/klibc/klibc.inc
> +++ b/meta-initramfs/recipes-devtools/klibc/klibc.inc
> @@ -16,6 +16,7 @@ SRC_URI_append_linux-uclibceabi = "
> file://klibc-config-eabi.patch \
>                                      "
>  SRC_URI += "file://klibc-linux-libc-dev.patch \
>              file://staging.patch \
> +            file://klcc-consider-sysroot.patch \
>              "
>
>  S = "${WORKDIR}/git"
> --
> 1.9.1
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org <javascript:;>
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [meta-initramfs][PATCH] klibc: klcc: consider --sysroot option and override gcc-cross encoded sysroot
  2014-09-04 19:57 ` Khem Raj
@ 2014-09-16 19:04   ` Andrea Adami
  0 siblings, 0 replies; 3+ messages in thread
From: Andrea Adami @ 2014-09-16 19:04 UTC (permalink / raw)
  To: openembeded-devel

On Thu, Sep 4, 2014 at 9:57 PM, Khem Raj <raj.khem@gmail.com> wrote:
> On Monday, September 1, 2014, Andrea Adami <andrea.adami@gmail.com> wrote:
>
>> For the recipes built with klcc-cross it is necessary to
>> pass --sysroot otherwise we default to the one encoded in gcc-cross which
>> actually is the 'first one' built.
>> The issue was revealed when building for armv4 after having built for
>> armv5te:
>> the produced binaries did contain Illegal Instruction (bx lr).
>>
>> Signed-off-by: Andrea Adami <andrea.adami@gmail.com <javascript:;>>
>> ---
>>  meta-initramfs/classes/klibc.bbclass                       |  4 ++--
>>  .../klibc/klibc-2.0.4/klcc-consider-sysroot.patch          | 14
>> ++++++++++++++
>>  meta-initramfs/recipes-devtools/klibc/klibc.inc            |  1 +
>>  3 files changed, 17 insertions(+), 2 deletions(-)
>>  create mode 100644
>> meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
>>
>> diff --git a/meta-initramfs/classes/klibc.bbclass
>> b/meta-initramfs/classes/klibc.bbclass
>> index ca741cd..8690472 100644
>> --- a/meta-initramfs/classes/klibc.bbclass
>> +++ b/meta-initramfs/classes/klibc.bbclass
>> @@ -4,8 +4,8 @@ DEPENDS =+ "klcc-cross"
>>  # Default for klcc is to build static binaries.
>>  # Set CC = "${TARGET_PREFIX}klcc -shared" to build the dynamic version.
>>
>> -export CC = "${TARGET_PREFIX}klcc"
>> -export CC_armv4_linux-gnueabi = "${TARGET_PREFIX}klcc -march=armv4
>> -mthumb-interwork"
>> +export CC = "${TARGET_PREFIX}klcc --sysroot=${STAGING_DIR_TARGET}"
>> +export CC_armv4_linux-gnueabi = "${TARGET_PREFIX}klcc
>> --sysroot=${STAGING_DIR_TARGET} -march=armv4 -mthumb-interwork"
>>
>> May be you can use TOOLCHAIN_OPTIONS
> here
>
Yes, if you advise I'd use that.

I am a bit scared looking at the mangling happening to TOOLCHAIN_OPTIONS...
http://cgit.openembedded.org/openembedded-core/log/?qt=grep&q=TOOLCHAIN_OPTIONS

Just few months ago klcc-cross recipe was inheriting cross so I can
imagine it would have fallen
(a195950 cross.bbclass: Set TOOLCHAIN_OPTIONS to an empty value
instead of duplicating...)

I can guess what will happen to klibc-bbclass if that value will be changed...

Thanks for reviewing
Cheers

Andrea

>
>  export CPP = "${CC} -E"
>>
>> diff --git
>> a/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
>> b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
>> new file mode 100644
>> index 0000000..9bc4835
>> --- /dev/null
>> +++
>> b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
>> @@ -0,0 +1,14 @@
>> +diff --git a/klcc/klcc.in b/klcc/klcc.in
>> +index 43d0984..61e9385 100644
>> +--- a/klcc/klcc.in
>> ++++ b/klcc/klcc.in
>> +@@ -204,6 +204,9 @@ while ( defined($a = shift(@ARGV)) ) {
>> +       # Libraries
>> +       push(@libs, $a);
>> +       push(@libs, shift(@ARGV)) if ( $2 eq '' );
>> ++    } elsif ( $a =~ /^--([sysroot=])(.*)$/ ) {
>> ++      # Override gcc encoded sysroot
>> ++      push(@ccopt, $a);
>> +     } else {
>> +       die "$0: unknown option: $a\n";
>> +     }
>> diff --git a/meta-initramfs/recipes-devtools/klibc/klibc.inc
>> b/meta-initramfs/recipes-devtools/klibc/klibc.inc
>> index 0209b20..f3e9972 100644
>> --- a/meta-initramfs/recipes-devtools/klibc/klibc.inc
>> +++ b/meta-initramfs/recipes-devtools/klibc/klibc.inc
>> @@ -16,6 +16,7 @@ SRC_URI_append_linux-uclibceabi = "
>> file://klibc-config-eabi.patch \
>>                                      "
>>  SRC_URI += "file://klibc-linux-libc-dev.patch \
>>              file://staging.patch \
>> +            file://klcc-consider-sysroot.patch \
>>              "
>>
>>  S = "${WORKDIR}/git"
>> --
>> 1.9.1
>>
>> --
>> _______________________________________________
>> Openembedded-devel mailing list
>> Openembedded-devel@lists.openembedded.org <javascript:;>
>> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
>>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-16 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-01 22:15 [meta-initramfs][PATCH] klibc: klcc: consider --sysroot option and override gcc-cross encoded sysroot Andrea Adami
2014-09-04 19:57 ` Khem Raj
2014-09-16 19:04   ` Andrea Adami

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.