Closed Bug 1839740 (relrhack) Opened 2 years ago Closed 1 year ago

Modernize elfhack

Categories

(Firefox Build System :: General, task)

task

Tracking

(firefox119 fixed)

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(4 files)

Elfhack is the main reason we're not using lld on Linux/Android shippable builds, because the way it works doesn't go well with how lld lays out ELF binaries. By leveraging the linker itself (BFD and lld both having recently gained the ability to generate the compact relocation info themselves), we can achieve a similar result to what elfhack is doing, while allowing to use lld.

Depends on: 1839741
Depends on: 1839743
Depends on: 1839746
Alias: relrhack
Depends on: 1841212
Depends on: 1841567
Depends on: 1841571
Depends on: 1843210
Depends on: 1844484
Blocks: 1839741
No longer depends on: 1839741

Elfhack acts as a linker, and it uses the elf_header symbol to point
at the ELF header in the injected code that applies relocations.
Both GNU ld and lld expose a __ehdr_start symbol with the same meaning,
so rename the elf_header symbol for compatibility. This will allow to
reuse the code in the upcoming replacement for elfhack.

Elfhack is the main reason we're not using lld on Linux/Android
shippable builds, because the way it works doesn't go well with how lld
lays out ELF binaries. By leveraging the linker itself (BFD and lld both
having recently gained the ability to generate the compact relocation
info themselves), we can achieve a similar result to what elfhack is
doing, while allowing to use lld.

See more in-depth background on https://glandium.org/blog/?p=4297

Disabled by default for now.

Blocks: 1850866
Blocks: 1850867
No longer blocks: 1839741
Depends on: 1851078
No longer depends on: 1851078
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/462a0de72bb9 Add linker kind to the elfhack configure test. r=firefox-build-system-reviewers,andi https://hg.mozilla.org/integration/autoland/rev/ff6f21fecdbe Rename the symbol by elfhack to point to the ELF header. r=firefox-build-system-reviewers,andi https://hg.mozilla.org/integration/autoland/rev/200dd4ded060 New relrhack tool, a modern replacement to elfhack. r=firefox-build-system-reviewers,sergesanspaille https://hg.mozilla.org/integration/autoland/rev/4d62c0c0c7e9 Hook relrhack in the build system. r=firefox-build-system-reviewers,andi
Blocks: 1854047
Blocks: 1854052
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: