-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
zig cc: add support for -L linker arguments #4893
Conversation
So you should be able to add: .{
.name = "library-directory",
.ident = "linker_input_l",
},
.{
.name = "library-directory=",
.ident = "linker_input_l",
}, to |
Note that the script will try appending a |
src/main.cpp
Outdated
linker_args.append(buf_create_from_str("-L")); | ||
linker_args.append(buf_create_from_str(it.only_arg)); |
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.
Instead of this you can simply do:
lib_dirs.append(it.only_arg);
This matches the -L
parameter from zig command line which you can see earlier in the file.
tools/update_clang_options.zig
Outdated
@@ -223,7 +227,7 @@ pub fn main() anyerror!void { | |||
try std.fmt.allocPrint(allocator, "-I={}/clang/include/clang/Driver", .{llvm_src_root}), | |||
}; | |||
|
|||
const child_result = try std.ChildProcess.exec(.{ | |||
const child_result = try std.ChildProcess.exec2(.{ |
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.
if you update to zig master branch then exec will be correct
Thanks for the contribution! |
src/main.cpp
Outdated
@@ -790,6 +794,9 @@ static int main0(int argc, char **argv) { | |||
buf_eql_str(arg, "-export-dynamic")) | |||
{ | |||
rdynamic = true; | |||
} else if (buf_eql_str(arg, "-L")) { | |||
i += 1; | |||
lib_dirs.append(buf_ptr(linker_args.at(i))); |
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.
Should I remove this change since I'm now adding to lib_dirs directly instead of adding to linker_args?
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.
I've removed it.
7162bc0
to
7be005a
Compare
7be005a
to
dfe33e6
Compare
Nice work! |
This is my first zig change. Do I need to run any tests? or add any test cases?
edit: This is towards the completion of zig cc (#4784)