Skip to content

add support for modern linkers on linux (e.g. lld, mold) - #90

Closed
SidneyCogdill wants to merge 2 commits into
fungos:masterfrom
SidneyCogdill:patch-elf-addr-lookup
Closed

SidneyCogdill wants to merge 2 commits into
fungos:masterfrom
SidneyCogdill:patch-elf-addr-lookup

Conversation

@SidneyCogdill

Copy link
Copy Markdown
Contributor

previous implementation assumes this layout:

[ .data ][ .state ][ .bss ]

where first writable PT_LOAD segment size ends exactly where .state ends and .bss begins.

this is the behavior with ld.bfd but is no longer the case with lld and mold (with reordered / separate segement and/or full relro support). and cr segfaults when reloading if linked with mold or lld.

this patch fixes that by using the dlpi_addr to resolve ELF section addresses directly.

works on my machine with ld.bfd and lld and mold with my local hello world example, may need more tests.

previous implementation assumes this layout:

[... .data ...][ .state ][ .bss ]

where first writable PT_LOAD segment size
ends exactly where .state ends and .bss
begins.

this is the behavior with ld.bfd but is no longer
the case with lld and mold (with reordered /
separate segement and/or full relro support).
and cr segfault when reloading if linked
with mold or lld.

this patch fixes that by storing and using
the dlpi_addr to resolve ELF section addresses
directly.
previous implementation assumes this layout:

[ .data ][ .state ][ .bss ]

where first writable PT_LOAD segment size
ends exactly where .state ends and .bss
begins.

this is the behavior with ld.bfd but is no longer
the case with lld and mold (with reordered /
separate segement and/or full relro support).
and cr segfaults when reloading if linked
with mold or lld.

this patch fixes that by using the dlpi_addr
to resolve ELF section addresses directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant