[lld] [lld] Add ability to have OUTPUT_FORMAT(binary) in linker script for ld.lld (PR #97765)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 14 14:29:01 PDT 2024


MaskRay wrote:

> > This needs a test in `oformat-binary.s`. A different `OUTPUT_FORMAT` might change `oFormatBinary` to false.
> 
> Okay, I want to write test(s) for this but I'm not sure what we need to be testing for here. Why would we want to test for the behaviors of `OUTPUT_FORMAT`s other than `binary`? This PR only changes the behavior of `OUTPUT_FORMAT(binary)`.
> 
> Is the test for the case where there are more than one `OUTPUT_FORMAT` directives present in a linker script? Does that even make sense for a linker script?

We want to test the behavior when more than one `OUTPUT_FORMAT` command is specified and the interaction with `--oformat=binary` (and when an ELF OUTPUT_FORMAT is specified).

After closer inspection of GNU ld's behavior, I think we probably should  ignore extra OUTPUT_FORMAT commands. #98837 

https://github.com/llvm/llvm-project/pull/97765


More information about the llvm-commits mailing list