devel/glib20 build issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

devel/glib20 build issue

Kristof Provost
Hi,

While trying to build assorted ports on RISC-V I found that devel/glib20
doesn’t build.
It turns out to be due to a missing __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
define. That define is implicitly set by the toolchain. Or, at least, it
is on other platforms (ARM, MIPS, x86, …), but not on RISC-V.

That’s likely just been forgotten. The following toolchain patch fixes
that for me:

        diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
        index 4ba703c8dd1..73f1b5bc446 100644
        --- a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
        +++ b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
        @@ -115,8 +115,14 @@ void RISCVTargetInfo::getTargetDefines(const
LangOptions &Opts,
             Builder.defineMacro("__riscv_muldiv");
           }

        -  if (HasA)
        +  if (HasA) {
             Builder.defineMacro("__riscv_atomic");
        +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
        +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
        +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
        +    if (Is64Bit)
        +           Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
        +  }

           if (HasF || HasD) {
             Builder.defineMacro("__riscv_flen", HasD ? "64" : "32");

Best regards,
Kristof
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: devel/glib20 build issue

Dimitry Andric-4
On 19 Nov 2020, at 11:57, Kristof Provost <[hidden email]> wrote:

>
> While trying to build assorted ports on RISC-V I found that devel/glib20 doesn’t build.
> It turns out to be due to a missing __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 define. That define is implicitly set by the toolchain. Or, at least, it is on other platforms (ARM, MIPS, x86, …), but not on RISC-V.
>
> That’s likely just been forgotten. The following toolchain patch fixes that for me:
>
> diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
> index 4ba703c8dd1..73f1b5bc446 100644
> --- a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
> +++ b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
> @@ -115,8 +115,14 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
>     Builder.defineMacro("__riscv_muldiv");
>   }
>
> -  if (HasA)
> +  if (HasA) {
>     Builder.defineMacro("__riscv_atomic");
> +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
> +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
> +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
> +    if (Is64Bit)
> +           Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
> +  }
>
>   if (HasF || HasD) {
>     Builder.defineMacro("__riscv_flen", HasD ? "64" : "32");
Hi Kristof,

Can you please submit this upstream? We already have way too many gratuitous RISC-V differences that haven't been upstreamed.

-Dimitry


signature.asc (230 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: devel/glib20 build issue

Kristof Provost
On 19 Nov 2020, at 11:59, Dimitry Andric wrote:

> On 19 Nov 2020, at 11:57, Kristof Provost <[hidden email]> wrote:
>>
>> While trying to build assorted ports on RISC-V I found that
>> devel/glib20 doesn’t build.
>> It turns out to be due to a missing
>> __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 define. That define is implicitly
>> set by the toolchain. Or, at least, it is on other platforms (ARM,
>> MIPS, x86, …), but not on RISC-V.
>>
>> That’s likely just been forgotten. The following toolchain patch
>> fixes that for me:
>>
>> diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
>> b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
>> index 4ba703c8dd1..73f1b5bc446 100644
>> --- a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
>> +++ b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
>> @@ -115,8 +115,14 @@ void RISCVTargetInfo::getTargetDefines(const
>> LangOptions &Opts,
>>     Builder.defineMacro("__riscv_muldiv");
>>   }
>>
>> -  if (HasA)
>> +  if (HasA) {
>>     Builder.defineMacro("__riscv_atomic");
>> +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
>> +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
>> +    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
>> +    if (Is64Bit)
>> +          
>> Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
>> +  }
>>
>>   if (HasF || HasD) {
>>     Builder.defineMacro("__riscv_flen", HasD ? "64" : "32");
>
> Hi Kristof,
>
> Can you please submit this upstream? We already have way too many
> gratuitous RISC-V differences that haven't been upstreamed.
>
https://reviews.llvm.org/D91784

Best regards,
Kristof
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "[hidden email]"