[llvm-dev] ARM64, dropping ADRP instructions, and ld.lld

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Mon May 21 06:53:15 PDT 2018


On 21 May 2018 at 14:23, Eric Gorr <ericgorr at gmail.com> wrote:
> I don't care about Mach-O at all. ELF is sufficient.

Ah, there's definitely no linker-optimization hints for ELF. The
compiler doesn't even emit the data that the linker would need.

> As an educated opinion, how difficult might something like this be? minutes? hours? days? weeks? months?

Probably a few hours on the compiler side for me (~1 plumbing "tiny"
through as a valid option, ~1-2 implementing it in AArch64, + time
compiling etc). It's actually a pretty simple change to make as these
things go; thread-local storage is likely to be the trickiest bit.

That's assuming the linker can cope with the new relocations, which
looks plausible from a quick grep but not a foregone conclusion.

> With this explanation in hand, one other alternative I was looking at was
> using a linkerscript to essentially rebase the code and have ADRP
> instructions that would address the correct location as a result.

You mean provide the explicit (misaligned) address you intend to load
the binary at and get the linker to fix things up? Theoretically it
would have sufficient information, but I don't know how you'd convince
it not to align pages.


More information about the llvm-dev mailing list