Open Bug 1483822 Opened 6 years ago Updated 2 years ago

[clang 7] test-array.so: terminate called after throwing an instance of 'std::runtime_error'

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: glandium, Unassigned)

References

(Blocks 1 open bug)

Details

what(): Segments overlap The problem is that lld changed its layout again. What test-array.so looks like is the following: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .dynsym DYNSYM 0000000000000270 000270 000120 18 A 6 1 8 [ 2] .gnu.version VERSYM 0000000000000390 000390 000018 02 A 1 0 2 [ 3] .gnu.version_r VERNEED 00000000000003a8 0003a8 000030 00 A 6 1 4 [ 4] .gnu.hash GNU_HASH 00000000000003d8 0003d8 00004c 00 A 1 0 8 [ 5] .hash HASH 0000000000000424 000424 000068 04 A 1 0 4 [ 6] .dynstr STRTAB 000000000000048c 00048c 0000d1 00 A 0 0 1 [ 7] .rela.dyn RELA 0000000000000560 000560 003af8 18 A 1 0 8 [ 8] .rela.plt RELA 0000000000004058 004058 000018 18 A 1 0 8 [ 9] .note.gnu.build-id NOTE 0000000000004070 004070 000018 00 A 0 0 4 [10] .rodata PROGBITS 0000000000004090 004090 0001fe 00 AMS 0 0 16 [11] .eh_frame_hdr PROGBITS 0000000000004290 004290 000024 00 A 0 0 4 [12] .eh_frame PROGBITS 00000000000042b8 0042b8 00009c 00 A 0 0 8 [13] .text PROGBITS 0000000000005000 005000 003027 00 AX 0 0 16 (...) With lld in clang 6, .rodata would appear at Nr 1. By way of how elfhack works, .rodata has an immutable address, and so does .text. By way of how lld works, they are both in different PT_LOADs (the PT_LOAD containing .text starts with .text) Now, what elfhack does is: - reduce the size of .rela.dyn, insert a .elfhack.data section, and move as much of the stuff that follows, which in this case is .rela.plt, and .note.gnu.build-id. - insert a .elfhack.text section before .text. Because .text is non-movable, the address of .elfhack.text is slightly below 0x5000. And because .rodata is non-movable, the address of .rodata stays 0x4090. .elfhack.text needs to be in the same PT_LOAD as .text. Which means, even if we moved .eh_frame* out of the way, we'd need to have a PT_LOAD ending at best at 0x428e, and a PT_LOAD starting at 0x4xxx, so both in the same page, which is not possible. That's what the "Segments overlap" error is about. The problem is not limited to the elfhack tests. The same layout happens in libxul.so, and would cause the same problem.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.