-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
[ELF] implement -Y flag #652
base: main
Are you sure you want to change the base?
Conversation
I think we should just handle it as an unknown flag to let people to stop using this old command line flag, if any. |
As you wish, thanks for the quick reply. I'm fine maintaining this patch in my tree as I need it, feel free to close the PR. |
What program do you need the |
Not a specific program, I use it when cross compiling root filesystems for embedded targets. The standard way of doing this is:
But to avoid copying the toolchain you can do (with ld.bfd):
Using |
bf2c440
to
df9e997
Compare
cc86039
to
25d02bb
Compare
@@ -998,6 +1002,10 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) { | |||
} | |||
} | |||
|
|||
ctx.arg.library_paths.insert(ctx.arg.library_paths.end(), | |||
default_library_paths.begin(), | |||
default_library_paths.end()); |
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'm not fully getting what is difference between -Y
and -L
options -- at the end, we are just concatenating them.
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.
Same difference as -isystem
and -I
, one prepends while the other appends. It's important because build systems usually append your global CFLAGS to the package CFLAGS, so as a distribution or embedded system maintainer, you need a reliable way to know how the system includes will be used. Using a sysroot is sometimes to much of a constraint (because you need to merge the toolchain and the staging rootfs build).
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.
Oh, I see now. It does make sense, thanks.
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.
LGTM.
Please consider supporting the -Y flag, which is supported by the bfd linker (but not gold):
While this is a compatibility option in bfd, it is still very useful when you want to share a cross-toolchain to build binaries and libraries for different targets, without having to copy the full toolchain to their staging dir and using the --sysroot option.