Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm: Implement sub-architecture translation in targetTriple(). #21574

Merged
merged 1 commit into from
Oct 5, 2024

Conversation

alexrp
Copy link
Member

@alexrp alexrp commented Oct 3, 2024

Addresses this problem: ziglang/zig-bootstrap#102 (comment)

@alexrp
Copy link
Member Author

alexrp commented Oct 3, 2024

A neat side effect here is that #10411 is significantly alleviated. For example, I can now build libffi for Arm soft float targets:

zig3 build -Dtarget=arm-linux-gnueabi
install
└─ install ffi
   └─ zig build-lib ffi Debug arm-linux-gnueabi 1 errors
/home/alexrp/Source/vezel-dev/libffi/src/arm/sysv.S:1:1: error: clang exited with code 1
error: error(compilation): clang failed with stderr: /home/alexrp/Source/vezel-dev/libffi/src/arm/sysv.S:167:2: error: instruction requires: armv5t
 blx lr @ call fn
 ^


error: the following command failed with 1 compilation errors:
/home/alexrp/Source/zig/build/debug/bin/zig build-lib -cflags -fexceptions -- /home/alexrp/Source/vezel-dev/libffi/src/closures.c /home/alexrp/Source/vezel-dev/libffi/src/java_raw_api.c /home/alexrp/Source/vezel-dev/libffi/src/prep_cif.c /home/alexrp/Source/vezel-dev/libffi/src/raw_api.c /home/alexrp/Source/vezel-dev/libffi/src/tramp.c /home/alexrp/Source/vezel-dev/libffi/src/types.c -cflags -fexceptions -- /home/alexrp/Source/vezel-dev/libffi/src/arm/ffi.c /home/alexrp/Source/vezel-dev/libffi/src/arm/sysv.S -ODebug -target arm-linux-gnueabi -mcpu baseline -I /home/alexrp/Source/vezel-dev/libffi/include -I /home/alexrp/Source/vezel-dev/libffi/src -I /home/alexrp/Source/vezel-dev/libffi/src/arm -I /home/alexrp/Source/vezel-dev/libffi/.zig-cache/o/3b1d40f9694c554307ff61b4c48f350f/ -I /home/alexrp/Source/vezel-dev/libffi/.zig-cache/o/02b1253f3139eca6241e4d644e83704b/ -Mroot -lc --cache-dir /home/alexrp/Source/vezel-dev/libffi/.zig-cache --global-cache-dir /home/alexrp/.cache/zig --name ffi -static --zig-lib-dir /home/alexrp/Source/zig/lib/ --listen=-
Build Summary: 2/5 steps succeeded; 1 failed
install transitive failure
└─ install ffi transitive failure
   └─ zig build-lib ffi Debug arm-linux-gnueabi 1 errors
error: the following build command failed with exit code 1:
/home/alexrp/Source/vezel-dev/libffi/.zig-cache/o/2057d466747404c7de931ecab5bce90d/build /home/alexrp/Source/zig/build/debug/bin/zig /home/alexrp/Source/zig/lib /home/alexrp/Source/vezel-dev/libffi /home/alexrp/Source/vezel-dev/libffi/.zig-cache /home/alexrp/.cache/zig --seed 0x14ecf161 -Z48792836574354d5 -Dtarget=arm-linux-gnueabizig4 build -Dtarget=arm-linux-gnueabi

It's still not properly fixed, of course, but passing the sub-architecture helps to enable instructions that would otherwise be disabled because the default for arm-linux-gnueabi is armv4t.

@alexrp alexrp merged commit d23db94 into ziglang:master Oct 5, 2024
10 checks passed
@alexrp alexrp deleted the llvm-sub-arch branch October 5, 2024 11:56
@andrewrk
Copy link
Member

andrewrk commented Oct 5, 2024

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants