diff mbox

[1,of,2] scripts/build/gcc.sh: When compiling a Canadian Cross avoid using -print-multi-lib

Message ID 95abeed3a485c4d5b02e.1348026168@localhost.localdomain
State Superseded
Headers show

Commit Message

David Holsgrove Sept. 19, 2012, 3:42 a.m. UTC
# HG changeset patch
# User David Holsgrove <david.holsgrove@xilinx.com>
# Date 1348016639 -36000
# Node ID 95abeed3a485c4d5b02e4860fc554d6841e1cc41
# Parent  2858a24a584642e263a920b4214c815c172ed547
scripts/build/gcc.sh: When compiling a Canadian Cross avoid using -print-multi-lib

With a candian cross, attempting to ${CT_TARGET}-gcc -print-multi-lib will fail

As this is only for pretty log output, can safely sidestep


--
For unsubscribe information see http://sourceware.org/lists.html#faq

Comments

Mike Frysinger Sept. 19, 2012, 4:37 a.m. UTC | #1
On Tuesday 18 September 2012 23:42:48 David Holsgrove wrote:
> With a candian cross, attempting to ${CT_TARGET}-gcc -print-multi-lib will
> fail

if you have access to the compiled code still, you should be able to execute 
the local xgcc for the relevant information i think
-mike
Ralf Corsepius Sept. 19, 2012, 1:44 p.m. UTC | #2
On 09/19/2012 06:37 AM, Mike Frysinger wrote:
> On Tuesday 18 September 2012 23:42:48 David Holsgrove wrote:
>> With a candian cross, attempting to ${CT_TARGET}-gcc -print-multi-lib will
>> fail
>
> if you have access to the compiled code still, you should be able to execute
> the local xgcc for the relevant information i think

Errm, this would be news to me ;)

AFAICT, to be able to build Canadian Crosses, you normally need to have 
a copy of a $build->$target cross-compiler pre-installed, which GCC then 
will use when building the $host->$target compiler.

It's at least how I build toolchains canadian-cross (I am not using 
crossgcc)

Ralf





--
For unsubscribe information see http://sourceware.org/lists.html#faq
Yann E. MORIN Sept. 19, 2012, 8:57 p.m. UTC | #3
David, All,

On Wednesday 19 September 2012 05:42:48 David Holsgrove wrote:
> # HG changeset patch
> # User David Holsgrove <david.holsgrove@xilinx.com>
> # Date 1348016639 -36000
> # Node ID 95abeed3a485c4d5b02e4860fc554d6841e1cc41
> # Parent  2858a24a584642e263a920b4214c815c172ed547
> scripts/build/gcc.sh: When compiling a Canadian Cross avoid using -print-multi-lib
> 
> With a candian cross, attempting to ${CT_TARGET}-gcc -print-multi-lib will fail

That's right. But the fix you suggest is wrong, see below.

> As this is only for pretty log output, can safely sidestep
> 
> diff -r 2858a24a5846 -r 95abeed3a485 scripts/build/cc/gcc.sh
> --- a/scripts/build/cc/gcc.sh	Sun Aug 12 07:45:42 2012 -0400
> +++ b/scripts/build/cc/gcc.sh	Wed Sep 19 11:03:59 2012 +1000
> @@ -460,7 +460,8 @@
>      [ -z "${file}" ] || ext=".${file##*.}"
>      CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
>  
> -    if [ "${CT_MULTILIB}" = "y" ]; then
> +    # Skip for Canadian Build, can't run on the system and only gives pretty log output.
> +    if [ "${CT_MULTILIB}" = "y" -a "${CT_CANADIAN}" != "y" ]; then

This is the part that deals with the core pass-1 and pass-2 compilers,
so they are expected to run on the build machine, so we should be able
to run them (hell, they're gonna be used later to build the C library!)

Unfortunately, that part also deals with the final compiler for bare metal,
which we indeed can not run when it's canadian.

>          multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib   \

Simply doing the following:
          multilibs=( $( "${CT_TARGET}-gcc" -print-multi-lib   \

is not enough here, as that would call:
  1- in cross-mode, and not bare-metal: only the core compiler
  2- in cross-mode, and bare-metal: the final compiler
  3- in canadian-mode, and not bare-metal: always the core compiler
  4- in canadian-mode, and bare-metal: always the core compiler

This is not possible, because:
  1- is OK
  2- is OK
  3- is OK
  4- is wrong: we want to know the final compiler multilib support, not
     the core compiler multilib support

>                         |tail -n +2 ) )
>          if [ ${#multilibs[@]} -ne 0 ]; then
> @@ -815,7 +816,8 @@
>      [ -z "${file}" ] || ext=".${file##*.}"
>      CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}"
>  
> -    if [ "${CT_MULTILIB}" = "y" ]; then
> +    # Skip for Canadian Build, can't run on the system and only gives pretty log output.
> +    if [ "${CT_MULTILIB}" = "y" -a "${CT_CANADIAN}" != "y" ]; then

Here, that's right. This is the part that deals with the final gcc for non
bare-metal. So we can only run it if its not canadian.

>          multilibs=( $( "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc" -print-multi-lib \
                           ^^^^^^^^^^^^^^^^
There's a latent bug here --/      That should be ${prefix}

I'll fix here.

So, do we still need to print the multilib status, after all?
Could we just remove that?

Regards,
Yann E. MORIN.
Yann E. MORIN Sept. 19, 2012, 8:59 p.m. UTC | #4
Mike, David, All,

On Wednesday 19 September 2012 06:37:06 Mike Frysinger wrote:
> On Tuesday 18 September 2012 23:42:48 David Holsgrove wrote:
> > With a candian cross, attempting to ${CT_TARGET}-gcc -print-multi-lib will
> > fail
> 
> if you have access to the compiled code still, you should be able to execute 
> the local xgcc for the relevant information i think

Right, but I'm not too fond of digging in the internals of gcc.

Regards,
Yann E. MORIN.
David Holsgrove Sept. 20, 2012, 1:47 a.m. UTC | #5
Hi Yann, Mike, Ralf, All

On 20 September 2012 06:57, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> David, All,
>
> On Wednesday 19 September 2012 05:42:48 David Holsgrove wrote:
> > # HG changeset patch
> > # User David Holsgrove <david.holsgrove@xilinx.com>
> > # Date 1348016639 -36000
> > # Node ID 95abeed3a485c4d5b02e4860fc554d6841e1cc41
> > # Parent  2858a24a584642e263a920b4214c815c172ed547
> > scripts/build/gcc.sh: When compiling a Canadian Cross avoid using
> > -print-multi-lib
> >
> > With a candian cross, attempting to ${CT_TARGET}-gcc -print-multi-lib
> > will fail
>
> That's right. But the fix you suggest is wrong, see below.
>
> > As this is only for pretty log output, can safely sidestep
> >
> > diff -r 2858a24a5846 -r 95abeed3a485 scripts/build/cc/gcc.sh
> > --- a/scripts/build/cc/gcc.sh Sun Aug 12 07:45:42 2012 -0400
> > +++ b/scripts/build/cc/gcc.sh Wed Sep 19 11:03:59 2012 +1000
> > @@ -460,7 +460,8 @@
> >      [ -z "${file}" ] || ext=".${file##*.}"
> >      CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}"
> > "${prefix}/bin/${CT_TARGET}-cc${ext}"
> >
> > -    if [ "${CT_MULTILIB}" = "y" ]; then
> > +    # Skip for Canadian Build, can't run on the system and only gives
> > pretty log output.
> > +    if [ "${CT_MULTILIB}" = "y" -a "${CT_CANADIAN}" != "y" ]; then
>
> This is the part that deals with the core pass-1 and pass-2 compilers,
> so they are expected to run on the build machine, so we should be able
> to run them (hell, they're gonna be used later to build the C library!)
>
> Unfortunately, that part also deals with the final compiler for bare
> metal,
> which we indeed can not run when it's canadian.
>

Yes, this is the reason for my change to the do_cc_core_backend as
well as the do_cc_backend version of this print-multi-lib log output,
my use cases are for canadian cross baremetal / canadian cross linux toolchains.

Perhaps a less obtrusive change for this would be;

 if [ "${CT_MULTILIB}" = "y"  ]; then
        if [ "${CT_CANADIAN}" = "y" -a "${CT_BARE_METAL}" = "y" ]; then
            CT_DoLog WARN "Canadian Cross Baremetal unable to confirm
multilibs configured correctly"
        else
            multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib   \
                           |tail -n +2 ) )
[SNIP]
        fi
    fi


> >          multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc"
> > -print-multi-lib   \
>
> Simply doing the following:
>           multilibs=( $( "${CT_TARGET}-gcc" -print-multi-lib   \
>
> is not enough here, as that would call:
>   1- in cross-mode, and not bare-metal: only the core compiler
>   2- in cross-mode, and bare-metal: the final compiler
>   3- in canadian-mode, and not bare-metal: always the core compiler
>   4- in canadian-mode, and bare-metal: always the core compiler
>
> This is not possible, because:
>   1- is OK
>   2- is OK
>   3- is OK
>   4- is wrong: we want to know the final compiler multilib support, not
>      the core compiler multilib support
>
> >                         |tail -n +2 ) )
> >          if [ ${#multilibs[@]} -ne 0 ]; then
> > @@ -815,7 +816,8 @@
> >      [ -z "${file}" ] || ext=".${file##*.}"
> >      CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}"
> > "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}"
> >
> > -    if [ "${CT_MULTILIB}" = "y" ]; then
> > +    # Skip for Canadian Build, can't run on the system and only gives
> > pretty log output.
> > +    if [ "${CT_MULTILIB}" = "y" -a "${CT_CANADIAN}" != "y" ]; then
>
> Here, that's right. This is the part that deals with the final gcc for non
> bare-metal. So we can only run it if its not canadian.
>
> >          multilibs=( $( "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc"
> > -print-multi-lib \
>                            ^^^^^^^^^^^^^^^^
> There's a latent bug here --/      That should be ${prefix}
>
> I'll fix here.
>
> So, do we still need to print the multilib status, after all?
> Could we just remove that?
>

It's a nice check, but in the conditions mentioned its impossible, and
is only a CT_DoLog EXTRA / CT_DoLog WARN in any case.

thanks,
David

> Regards,
> Yann E. MORIN.
>
> --
>
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
> conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
> |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is
> no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
> conspiracy.  |
>
> '------------------------------^-------^------------------^--------------------'
>
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
>

--
For unsubscribe information see http://sourceware.org/lists.html#faq
diff mbox

Patch

diff -r 2858a24a5846 -r 95abeed3a485 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Sun Aug 12 07:45:42 2012 -0400
+++ b/scripts/build/cc/gcc.sh	Wed Sep 19 11:03:59 2012 +1000
@@ -460,7 +460,8 @@ 
     [ -z "${file}" ] || ext=".${file##*.}"
     CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
 
-    if [ "${CT_MULTILIB}" = "y" ]; then
+    # Skip for Canadian Build, can't run on the system and only gives pretty log output.
+    if [ "${CT_MULTILIB}" = "y" -a "${CT_CANADIAN}" != "y" ]; then
         multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib   \
                        |tail -n +2 ) )
         if [ ${#multilibs[@]} -ne 0 ]; then
@@ -815,7 +816,8 @@ 
     [ -z "${file}" ] || ext=".${file##*.}"
     CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}"
 
-    if [ "${CT_MULTILIB}" = "y" ]; then
+    # Skip for Canadian Build, can't run on the system and only gives pretty log output.
+    if [ "${CT_MULTILIB}" = "y" -a "${CT_CANADIAN}" != "y" ]; then
         multilibs=( $( "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc" -print-multi-lib \
                        |tail -n +2 ) )
         if [ ${#multilibs[@]} -ne 0 ]; then