2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00

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]
This commit is contained in:
Vladimir Prus
2009-05-31 18:49:11 +00:00
parent fe12dc59bb
commit 6a52abb597
2 changed files with 47 additions and 9 deletions

View File

@@ -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) = <s>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 <architecture>x86/<address-model>32 : -m32 ;
toolset.flags gcc OPTIONS <architecture>x86/<address-model>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 <architecture>sparc/<address-model>32 : -m32 ;
toolset.flags gcc OPTIONS <architecture>sparc/<address-model>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 <architecture>power/<address-model>32 : -m32 ;
toolset.flags gcc OPTIONS <architecture>power/<address-model>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 <architecture>power/<address-model>32/<target-os>aix : -maix32 ;
toolset.flags gcc OPTIONS <architecture>power/<address-model>64/<target-os>aix : -maix64 ;
toolset.flags gcc AROPTIONS <architecture>power/<address-model>64/<target-os>aix : "-X 64" ;
toolset.flags gcc AROPTIONS <address-model>64/<target-os>aix : "-X 64" ;

View File

@@ -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) = <s>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) = <s>gcc-link-semaphore ;
}