ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
35.2k stars 2.57k forks source link

`zig cc -target powerpc64le-linux-gnu` missing __gcc_qadd and __gcc_qmul #22081

Open bjia56 opened 5 days ago

bjia56 commented 5 days ago

Zig Version

0.14.0-dev.2310+b0dcce93f

Steps to Reproduce and Observed Behavior

#include <stdio.h>

int main() {
    long double a = 1.0e+119L;
    long double b = 1.0e+119L;
    long double c;

    c = a + b;
    printf("qadd: %Lf\n", c);
    c = a * b;
    printf("qmul: %Lf\n", c);

    return 0;
}
$ ./zig-linux-x86_64-0.14.0-dev.2310+b0dcce93f/zig cc -target powerpc64le-linux-gnu test.c
ld.lld: error: undefined symbol: __gcc_qadd
>>> referenced by test.c:8
>>>               /path/to/.cache/zig/o/e9f09ac644b53b3941359b8b9b0bfc63/test.o:(main)

ld.lld: error: undefined symbol: __gcc_qmul
>>> referenced by test.c:10
>>>               /path/to/.cache/zig/o/e9f09ac644b53b3941359b8b9b0bfc63/test.o:(main)

The above is a minimal reproducible example of an issue that occurs when building sqlite3 for powerpc64le-linux-gnu.

Expected Behavior

Compilation succeeds.

alexrp commented 5 days ago

For this to work in zig cc/zig c++, we need to port these over: https://github.com/llvm/llvm-project/tree/main/compiler-rt/lib/builtins/ppc

Note that Zig language support requires #20579.