Add support for --no-warn-mismatch for ELF#1167
Conversation
8f3dcad to
32d6c33
Compare
|
This PR will address file mismatches using header information. Architecture specific changes will be handled in another issue/PR. |
|
While updating the tests I noticed that the dynamic version of the test crashes in the readDynamic function in the DynamicELFReader.cpp file. I think this is unrelated to the issue at hand so I will raise an issue about it. |
|
I updated the RISCV FloatABI and Emulation tests since they were expecting --warn-mismatch to be enabled. |
There was a problem hiding this comment.
For aarch64, arm, and riscv, the default behavior (with no flag at all) silently accepts any object:
# before
ld.eld -m aarch64linux a.arm.o # cannot recognize the format ... (exit 1)
ld.eld -m elf32lriscv a.rv64.o # Error: Invalid ELF file ... (exit 1)
# after
ld.eld -m aarch64linux a.arm.o # succeeds
ld.eld -m elf32lriscv a.rv64.o # succeeds (32-bit ELF output with rv64 contents merged)
This is really confusing imo and unsafe. Ideally, we would match GNU ld where --no-warn-mismatch is opt-in. This would remove the 3-state enum to a simple boolean and fix the aarch64/arm/riscv default regression.
GNU ld's no-warn-mismatch also differs from this patch in that it does not allow ELFs of different classes to be mixed, while we do. I think we should follow the GNU linker and not relax the checkClass() check. It is also probably unsafe: a 64-bit object in a 32-bit link gets parsed by the 32-bit parser.
I think it is best that the team meets up next week to discuss this since there are multiple opinions about how to address this issue. I'll schedule everything with Shankar. Thanks for the feedback. |
Allow users to suppress warnings about incompatible or mismatched input files using the --no-warn-mismatch option. This change disables mismatch diagnostics while preserving normal link behavior and outcomes. Fix: qualcomm#1214 Signed-off-by: Steven Ramirez Rosa <ramirezr@qti.qualcomm.com>
|
This PR only addresses --no-warn-mismatch and how it handled ELF information conflicts. It follows GNU's ld. Keep the feedback focus on this, as anything else will need to be handled in another issue/PR. |
|
I was mistaken on GNU ld not allowing different ELF classes to be mixed with its
|
Each architecture defines the default value differently if no flag is passed. This should be handled in another issue/PR. I can look into it as soon as I'm done with --no-warn-mismatch. |
Allow users to suppress warnings about incompatible or mismatched input files using the --no-warn-mismatch option. This change disables mismatch diagnostics while preserving normal link behavior and outcomes.
Fix: #1214