From 6a52abb59791ed4b03020187f687b22f3769fee6 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sun, 31 May 2009 18:49:11 +0000 Subject: [PATCH] Make address-model take effect even if architecture is not specified. It seems more ultimately helpful to directly translate address-model to -m32/-m64 on gcc, since that option works fine even if -march is not specified. [SVN r53510] --- src/tools/gcc.jam | 50 ++++++++++++++++++++++++++++++++------- src/tools/intel-linux.jam | 6 +++++ 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/tools/gcc.jam b/src/tools/gcc.jam index eb818030e..78d961acf 100644 --- a/src/tools/gcc.jam +++ b/src/tools/gcc.jam @@ -349,6 +349,40 @@ rule setup-fpic ( targets * : sources * : properties * ) } } +rule setup-address-model ( targets * : sources * : properties * ) +{ + local model = [ feature.get-values address-model : $(properties) ] ; + if $(model) + { + local option ; + local os = [ feature.get-values target-os : $(properties) ] ; + if $(os) = aix + { + if $(model) = 32 + { + option = -maix32 ; + } + else + { + option = -maix64 ; + } + } + else + { + if $(model) = 32 + { + option = -m32 ; + } + else + { + option = -m64 ; + } + } + OPTIONS on $(targets) += $(option) ; + } +} + + # FIXME: this should not use os.name. if [ os.name ] != NT && [ os.name ] != OSF && [ os.name ] != HPUX && [ os.name ] != AIX { @@ -369,6 +403,7 @@ rule compile.c++.pch ( targets * : sources * : properties * ) { setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; } actions compile.c++.pch @@ -380,6 +415,7 @@ rule compile.c.pch ( targets * : sources * : properties * ) { setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; } actions compile.c.pch @@ -391,6 +427,7 @@ rule compile.c++ ( targets * : sources * : properties * ) { setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; # Some extensions are compiled as C++ by default. For others, we need to # pass -x c++. We could always pass -x c++ but distcc does not work with it. @@ -420,6 +457,7 @@ rule compile.c ( targets * : sources * : properties * ) { setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; # If we use the name g++ then default file suffix -> language mapping does # not work. So have to pass -x option. Maybe, we can work around this by @@ -745,6 +783,7 @@ rule init-link-flags ( toolset linker condition ) rule link ( targets * : sources * : properties * ) { setup-threading $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; SPACE on $(targets) = " " ; # Serialize execution of the 'link' action, since running N links in # parallel is just slower. For now, serialize only gcc links, it might be a @@ -809,6 +848,7 @@ actions piecemeal archive rule link.dll ( targets * : sources * : properties * ) { setup-threading $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; SPACE on $(targets) = " " ; JAM_SEMAPHORE on $(targets) = gcc-link-semaphore ; } @@ -896,8 +936,6 @@ local rule cpu-flags ( toolset variable : architecture : instruction-set + : val # Set architecture/instruction-set options. # # x86 and compatible -toolset.flags gcc OPTIONS x86/32 : -m32 ; -toolset.flags gcc OPTIONS x86/64 : -m64 ; cpu-flags gcc OPTIONS : x86 : i386 : -march=i386 : default ; cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ; cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ; @@ -931,8 +969,6 @@ cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ; cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ; cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ; # Sparc -toolset.flags gcc OPTIONS sparc/32 : -m32 ; -toolset.flags gcc OPTIONS sparc/64 : -m64 ; cpu-flags gcc OPTIONS : sparc : c3 : -mcpu=c3 : default ; cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 ; cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ; @@ -949,8 +985,6 @@ cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ; cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ; cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ; # RS/6000 & PowerPC -toolset.flags gcc OPTIONS power/32 : -m32 ; -toolset.flags gcc OPTIONS power/64 : -m64 ; cpu-flags gcc OPTIONS : power : 403 : -mcpu=403 ; cpu-flags gcc OPTIONS : power : 505 : -mcpu=505 ; cpu-flags gcc OPTIONS : power : 601 : -mcpu=601 ; @@ -984,6 +1018,4 @@ cpu-flags gcc OPTIONS : power : rios2 : -mcpu=rios2 ; cpu-flags gcc OPTIONS : power : rsc : -mcpu=rsc ; cpu-flags gcc OPTIONS : power : rs64a : -mcpu=rs64 ; # AIX variant of RS/6000 & PowerPC -toolset.flags gcc OPTIONS power/32/aix : -maix32 ; -toolset.flags gcc OPTIONS power/64/aix : -maix64 ; -toolset.flags gcc AROPTIONS power/64/aix : "-X 64" ; +toolset.flags gcc AROPTIONS 64/aix : "-X 64" ; diff --git a/src/tools/intel-linux.jam b/src/tools/intel-linux.jam index de5bf8c7c..82c498c3a 100644 --- a/src/tools/intel-linux.jam +++ b/src/tools/intel-linux.jam @@ -112,6 +112,7 @@ rule compile.c++ ( targets * : sources * : properties * ) { gcc.setup-threading $(targets) : $(sources) : $(properties) ; gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; } @@ -124,6 +125,7 @@ rule compile.c ( targets * : sources * : properties * ) { gcc.setup-threading $(targets) : $(sources) : $(properties) ; gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; } @@ -136,6 +138,7 @@ rule compile.c++.pch ( targets * : sources * : properties * ) { gcc.setup-threading $(targets) : $(sources) : $(properties) ; gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; } # # Compiling a pch first deletes any existing *.pchi file, as Intel's compiler @@ -151,6 +154,7 @@ rule compile.c.pch ( targets * : sources * : properties * ) { gcc.setup-threading $(targets) : $(sources) : $(properties) ; gcc.setup-fpic $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; } actions compile.c.pch @@ -161,6 +165,7 @@ actions compile.c.pch rule link ( targets * : sources * : properties * ) { gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; SPACE on $(targets) = " " ; JAM_SEMAPHORE on $(targets) = gcc-link-semaphore ; } @@ -173,6 +178,7 @@ actions link bind LIBRARIES rule link.dll ( targets * : sources * : properties * ) { gcc.setup-threading $(targets) : $(sources) : $(properties) ; + gcc.setup-address-model $(targets) : $(sources) : $(properties) ; SPACE on $(targets) = " " ; JAM_SEMAPHORE on $(targets) = gcc-link-semaphore ; }