-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: make zig cc
pass -l
/-L
like Clang/GCC for ELF
#19818
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
base: master
Are you sure you want to change the base?
fix: make zig cc
pass -l
/-L
like Clang/GCC for ELF
#19818
Conversation
@motiejus @kubkon This PR builds on the functionality implemented in #15743 and should also fix |
5f810f0
to
1860048
Compare
9107b5a
to
8d5fc36
Compare
b4dcd83
to
094faf4
Compare
094faf4
to
b3cfcab
Compare
b3cfcab
to
f211d2d
Compare
I am in the process of rebasing this on current mainline |
f211d2d
to
46752f5
Compare
zig cc
pass -l/-L
like Clang/GCC for ELFzig cc
pass -l
/-L
like Clang/GCC for ELF
46752f5
to
2af0d55
Compare
I've rebased this PR. The fix itself is in The new test is in The rest of the changes are new functionality needed for the test:
|
2af0d55
to
b8f46fa
Compare
I made some changes to avoid reconstructing the library name and directory in |
This commit adds `addLibraryPathSpecial` for `Build.Module` and `Build.Step.Compile`. Like `addLibraryPath` but for `[]const u8`. `addRPathSpecial` is also added for `Build.Step.Compile` for completeness. This is needed to implement the new test in ziglang#19818.
This commit adds the `soname` option for `Build.Module` and `OverlayOptions`. This controls whether `-fsoname` or `-fno-soname` is passed to the linker. This is needed to implement the new test in ziglang#19818
We need this to implement the new test in ziglang#19818 This commits adds: * `setCwd` for `Build.Step.Compile`. Allows setting current directory for compile steps. * `opt_cwd` for `evalZigProcess` in `Build.Step`. Allows running `evalZigProcess` in a specific directory. Needed for setting current directory for compile steps. `--zig-lib-dir` is now appended differently in `Build.Step.Compile`. This is needed for compatibility with `setCwd`.
b8f46fa
to
077f287
Compare
This commit adds the `omit_soname` option for `Build.Module` and `OverlayOptions`. This controls whether `-fsoname` or `-fno-soname` is passed to the linker. This is needed to implement the new test in ziglang#19818
We need this to implement the new test in ziglang#19818 This commits adds: * `setCwd` for `Build.Step.Compile`. Allows setting current directory for compile steps. * `opt_cwd` for `evalZigProcess` in `Build.Step`. Allows running `evalZigProcess` in a specific directory. Needed for setting current directory for compile steps. `--zig-lib-dir` is now appended differently in `Build.Step.Compile`. This is needed for compatibility with `setCwd`.
077f287
to
ac69db5
Compare
This commit adds the `soname` option for `Build.Module` and `OverlayOptions`. This controls whether `-fsoname` or `-fno-soname` is passed to the linker. This is needed to implement the new test in ziglang#19818
ac69db5
to
0a646aa
Compare
This commit adds the `soname` option for `Build.Module` and `OverlayOptions`. This controls whether `-fsoname` or `-fno-soname` is passed to the linker. This is needed to implement the new test in ziglang#19818
0a646aa
to
b0c5bbb
Compare
I've removed everything related to |
This commit adds the `soname` option for `Build.Module` and `OverlayOptions`. This controls whether `-fsoname` or `-fno-soname` is passed to the linker. The `SOName` type is moved to `std.zig` to make it accessible in other modules. This is needed to implement the new test in ziglang#19818
b0c5bbb
to
7f064ee
Compare
This commit adds the `soname` option for `Build.Module` and `OverlayOptions`. This controls whether `-fsoname` or `-fno-soname` is passed to the linker. The `SoName` type is moved to `std.zig` to make it accessible in other modules. This is needed to implement the new test in ziglang#19818
This test follows the example from ziglang#19699.
7f064ee
to
31be45e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems okay to me. But I'm also not deeply familiar with this stuff, so it's possible that there are subtle details that I'm missing.
@andrewrk do you want to have a look before this gets merged?
Yes, thank you. |
Hi, any updates on this topic? Is this going to be merged as it's already approved? |
This PR is my attempt to fix #19699 by making the way
zig cc
passes-l/-L
flags for ELF linking consistent with Clang and GCC.I've added a test case that mimics the example in the issue description. Without the changes this PR makes to
src
, the new test case fails as expected withI am not sure if
test/tests.zig
is the best place for it - I couldn't find a good way to test this intest/link/elf.zig
ortest/standalone
.