On 01/19/2016 02:38 PM, Mike Frysinger wrote:
> On 19 Jan 2016 14:16, Alex McWhirter wrote:
>> I found the issue here, but i'm not sure how to handle it. The logic in
>> common.eblit is wrong for sparc64. See below
>>
>> <snip>
>> local cpu
>> case ${CTARGET} in
>> sparc64-*)
>> case $(get-flag mcpu) in
>> niagara[234])
>> if version_is_at_least 2.8 ; then
>> cpu="sparc64v2"
>> elif version_is_at_least 2.4 ; then
>> cpu="sparc64v"
>> elif version_is_at_least 2.2.3 ;
>> then
>> cpu="sparc64b"
>> fi
>> ;;
>> niagara)
>> if version_is_at_least 2.4 ; then
>> cpu="sparc64v"
>> elif version_is_at_least 2.2.3 ;
>> then
>> cpu="sparc64b"
>> fi
>> ;;
>> ultrasparc3)
>> cpu="sparc64b"
>> ;;
>> *)
>> # We need to force at least v9a
>> because the base build doesn't
>> # work with just v9.
>> #
>> https://sourceware.org/bugzilla/show_bug.cgi?id=19477
>> [[ -z ${cpu} ]] && append-flags
>> "-Wa,-xarch=v9a"
>> ;;
>> esac
>> ;;
>> </snip>
>>
>> Pulling from CHOST and basing CTARGET off of that is probably not the
>> best idea for sparc64 because the result will always be 64 bit. Hence
>> why we have build errors when attempting 32bit multi lib.
> i don't think that's the case. if you look up a level:
> - setup_target_flags is only called by setup_flags
> - setup_flags is only called by setup_env
> - setup_env first calls multilib_env
>
> so multilib_env should have set up the state such that CTARGET reflects
> the current ABI (e.g. a sparc-* tuple) rather than the native one (e.g.
> always sparc64-*).
>
>> Also, mcpu=ultrasparc will set the target to v9a and all sparv9 boxes
>> are backwards compatible to v9a. Ultrasparc being the lowest common
>> denominator for 64 bit means we can clean up the wild card a bit. That's
>> not a big deal really, forcing v9a should have a similar effect.
> the reason that append is there is to workaround (imo) a build bug rather
> than something we really want to be doing. if we did it all the time, it
> would clobber existing flags someone might have set.
>
>> I need to research the specific targets a bit and maybe i can come up
>> with an answer. Do we have {$ABI} here?
> we have $ABI, but it should have already been selected (see my call
> graph above)
>
> -mike
Perhaps we have a bug somewhere else then?
The output below is from a GLIBC build
* Configuring glibc for nptl
* ABI: sparc32
* CBUILD: sparc64-unknown-linux-gnu
* CHOST: sparc64-unknown-linux-gnu
* CTARGET: sparc64-unknown-linux-gnu
* CBUILD_OPT: sparc64-unknown-linux-gnu
* CTARGET_OPT: sparc64-unknown-linux-gnu
* CC: sparc64-unknown-linux-gnu-gcc -m32
* LD:
* ASFLAGS:
* CFLAGS: -mcpu=ultrasparc -pipe -fcall-used-g6 -O2
-fno-strict-aliasing
* CPPFLAGS:
* CXXFLAGS: -mcpu=ultrasparc -pipe -fcall-used-g6 -O2
-fno-strict-aliasing
* LDFLAGS: -Wl,-O1 -Wl,--as-needed
* Manual CC: sparc64-unknown-linux-gnu-gcc -m32 -Wl,-O1
-Wl,--as-needed
multilib_env is pulling the in ABI correctly, but not CTARGET. Unless we
should be setting CTARGET_$ABI in the profile?
I have the CHOST's below in the profile now.
CHOST_sparc32="sparc-unknown-linux-gnu"
CHOST_sparc64="sparc64-unknown-linux-gnu"