diff mbox

Allow -m32 to be passed via CT_EXTRA_CFLAGS_FOR_BUILD when building 32-bit crossgdb on 64-bit machine

Message ID 20140716215713.GA25910@mrv.com
State Under Review
Headers show

Commit Message

Nye Liu July 16, 2014, 9:57 p.m. UTC
Not sure if this is the right way to do it, but I pass -m32 via
CT_EXTRA_CFLAGS_FOR_BUILD when building 32-bit binaries on a 64-bit
host.

Without this, crosstool will build everything 32-bit EXCEPT for gdb!

Perhaps it should just go in CC_for_gdb and LD_for_gdb?

Especially if explicitly specifying "-g -O2" (the default in gdb
configure) is a bad idea?

Comments

Cody P Schafer July 19, 2014, 11:40 p.m. UTC | #1
On Wed, Jul 16, 2014 at 5:57 PM, Nye Liu <nyet@mrv.com> wrote:
> Not sure if this is the right way to do it, but I pass -m32 via
> CT_EXTRA_CFLAGS_FOR_BUILD when building 32-bit binaries on a 64-bit
> host.
>
> Without this, crosstool will build everything 32-bit EXCEPT for gdb!
>
> Perhaps it should just go in CC_for_gdb and LD_for_gdb?

That would allow the CFLAGS/CXXFLAGS to override the ones specified in
CT_EXTRA_CFLAGS_FOR_BUILD, rather than the other way around (which is
desirable).

> Especially if explicitly specifying "-g -O2" (the default in gdb
> configure) is a bad idea?

It's not perfect, but given that -g and -O2 can be disabled by
subsequent options in CT_EXTRA_CFLAGS_FOR_BUILD (-g0 and -O0/-O), it
isn't a total wash. Of course, if one has some funky CC with default
optimization/debug levels they want to use, they'll be out of luck
once -g -O2 overrides them.

Not sure we should care about the last case.

> diff -r 069f43a215cc scripts/build/debug/300-gdb.sh
> --- a/scripts/build/debug/300-gdb.sh    Wed Jun 25 23:33:01 2014 +0200
> +++ b/scripts/build/debug/300-gdb.sh    Wed Jul 16 14:51:58 2014 -0700
> @@ -155,6 +155,8 @@
>          CT_DoExecLog CFG                                \
>          CC="${CC_for_gdb}"                              \
>          LD="${LD_for_gdb}"                              \
> +        CFLAGS="-g -O2 ${CT_EXTRA_CFLAGS_FOR_BUILD}"    \
> +        CXXFLAGS="-g -O2 ${CT_EXTRA_CFLAGS_FOR_BUILD}"  \
>          "${gdb_src_dir}/configure"                      \
>              --build=${CT_BUILD}                         \
>              --host=${CT_HOST}                           \

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

Patch

diff -r 069f43a215cc scripts/build/debug/300-gdb.sh
--- a/scripts/build/debug/300-gdb.sh	Wed Jun 25 23:33:01 2014 +0200
+++ b/scripts/build/debug/300-gdb.sh	Wed Jul 16 14:51:58 2014 -0700
@@ -155,6 +155,8 @@ 
         CT_DoExecLog CFG                                \
         CC="${CC_for_gdb}"                              \
         LD="${LD_for_gdb}"                              \
+        CFLAGS="-g -O2 ${CT_EXTRA_CFLAGS_FOR_BUILD}"    \
+        CXXFLAGS="-g -O2 ${CT_EXTRA_CFLAGS_FOR_BUILD}"  \
         "${gdb_src_dir}/configure"                      \
             --build=${CT_BUILD}                         \
             --host=${CT_HOST}                           \