[PATCH] D43942: [lld] Fix handling of output section selection for unmerged mergeable inputs and relocatable output
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 2 11:59:33 PST 2018
Rafael Avila de Espindola <rafael.espindola at gmail.com> writes:
> Owen Reynolds via Phabricator via llvm-commits
> <llvm-commits at lists.llvm.org> writes:
>
>> gbreynoo added a comment.
>>
>> We found that there were problems with DWARF output when using the flags above, consumers were either creating incorrect output or crashing. These consumers where relying on there only being one .debug_str section. The DWARF specification has an attribute that is an offset into the .debug_str section (e.g. DW_form_strp), only one of such section is expected.
>
> Do you have a self contained testcase?
As an example I tried compiling
void foo(void) {}
and the DW_form_strp seem to use a relocation, so it is clear what
section they refer to:
.section .debug_str,"MS", at progbits,1
...
.Linfo_string3:
.asciz "foo" # string offset=146
If I "ld -O0 -r" that file with one defining a function bar and pass it
to llvm-readobj -r --expand-relocs I see two .debug_str sections, but
the relocations use the correct one. For example:
Relocation {
Offset: 0x39
Type: R_X86_64_32 (10)
Symbol: .debug_str (2)
Addend: 0x92
}
Relocation {
Offset: 0x4C
Type: R_X86_64_32 (10)
Symbol: .debug_str (12)
Addend: 0x0
}
So the output seems valid.
Also note that as written I think your patch would concatenate SHF_MERGE
sections with different sh_entsize.
Cheers,
Rafael
More information about the llvm-commits
mailing list