-
Notifications
You must be signed in to change notification settings - Fork 37
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
Describe the behaviour of the linker for ABI mismatches #15
base: main
Are you sure you want to change the base?
Conversation
Certain ABI requirements of the code contained in an object file are described by the `e_flags` field of the ELF header in an ELF object file. An ELF linker is able to inspect this and provide validation that ABI mismatches do not accidentally occur. Describe how the mismatches should be validated so that different toolchains perform the validation similarly. Currently the BFD linker is more lenient about the check, permitting inconsequential object files (files which do not contribute to the text segment) to be excluded from the requirements while lld is overly restrictive and does not permit the mismatch for any input.
CC: @asb @jim-wilson |
@jrtc27 @kito-cheng: any thoughts on this one? |
I dispute the "overly restrictive" part; you can come up with C inputs that aren't compatible yet BFD won't give an error for because it's trying to support other use cases that can be done an equivalent way (turning a binary blob into an ELF; historically people do things like |
+@MaskRay too |
because the impact of the calling convention is limited to the code | ||
contributions of an object file, any empty object file (i.e. containing no | ||
sections) or any object file which does not contribute any text sections which | ||
are loaded at runtime shall be excluded from the requirement that the floating |
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.
To be clear: this is not what LLD does and I am personally of the view it should continue to not do this. Just because BFD does something doesn't mean it's the right thing to do. There are ways to avoid this issue entirely and I am loathe to provide users with more footguns than necessary in the LLVM ecosystem, regardless of what GNU developers chose to do 5 years ago.
are loaded at runtime shall be excluded from the requirement that the floating | ||
point passing convention and the use of RVE match across all the object files. | ||
|
||
### Issues for consideration |
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 think this should go away entirely. It's certainly not normative text, and linking files with different floating point ABIs that have code in them is definitely asking for so much trouble that you can't just disable the checking. This is how you end up with users building programs that blow up and complaining at toolchain developers that the compiler doesn't work.
Certain ABI requirements of the code contained in an object file are
described by the
e_flags
field of the ELF header in an ELF objectfile. An ELF linker is able to inspect this and provide validation that
ABI mismatches do not accidentally occur.
Describe how the mismatches should be validated so that different
toolchains perform the validation similarly. Currently the BFD linker
is more lenient about the check, permitting inconsequential object files
(files which do not contribute to the text segment) to be excluded from
the requirements while lld is overly restrictive and does not permit the
mismatch for any input.