Details
Diff Detail
Event Timeline
With this patch, lld simply selects the last object file passed via the command line and sets the ABI version field to the value read from the object file. But is this what you actually want? What if all input files except the last one have ABI version 1, and the last one has ABI version 0?
I quickly hacked up this patch: https://gist.github.com/rui314/f3cd508b6cbbde763fc13bc6190d7505 Does this look good?
ELF/Writer.cpp | ||
---|---|---|
2410 | getAbiVersion is intended to be the single place to compute an ABI version number to write to to an output file. You should always call it under any circumstances. |
The patch you linked will work. Alternatively, can you take a look at the updated patch I just posted?
Is there any reason to not implement this for all targets? In your link you specifically check for EM_AMDGPU...
Also it seems like OSABI is also suffering from the problem you described in your first comment. Is this intentional?
Thanks
The interpretation of ABI version of an ELF object file depends on the target machine type. For example, we can think of a target that allows a mix of version X and version Y objects let a linker to create a shim between cross-version function call. At least most ABIs don't define anything about the ABI version, so it is perhaps most natural to ignore the field at all, unless you are linking for a specific target in which the ABI version has a special meaning. Therefore, I'd think code that works only for AMDGPU target is better.
Ok, sounds fair. Do you want me to incorporate your patch into this review?
If you find that patch OK, yes.
getAbiVersion is intended to be the single place to compute an ABI version number to write to to an output file. You should always call it under any circumstances.