This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Disallow the MachO specific .loh directive for windows
ClosedPublic

Authored by mstorsjo on Jul 27 2018, 12:10 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Jul 27 2018, 12:10 PM
compnerd requested changes to this revision.Jul 30 2018, 1:08 PM

Can you move the LOH handling into the DarwinAsmParser rather than adding the MachO specific check here please?

This revision now requires changes to proceed.Jul 30 2018, 1:08 PM

Can you move the LOH handling into the DarwinAsmParser rather than adding the MachO specific check here please?

DarwinAsmParser seems to be mostly arch independent features at the moment, while this directive only seems to be implemented for aarch64 at the moment.

mstorsjo updated this revision to Diff 158193.Jul 31 2018, 2:31 AM

Rebased on top of the latest trunk, after SVN r338355.

IMO, linker optimization hints are more an AArch64 thing than a Darwin thing. They were invented entirely to deal with AArch64's ADRP/whatever sequences so I'd prefer the implementation to stay in lib/Target/AArch64 where possible.

compnerd accepted this revision.Jul 31 2018, 3:32 PM

@t.p.northover - okay, in that case, we can leave it here. I suppose that this is caused by the pair-wise split relocations à la IMAGE_REL_ARM_MOV32T for PE/COFF?

This revision is now accepted and ready to land.Jul 31 2018, 3:32 PM
This revision was automatically updated to reflect the committed changes.

I suppose that this is caused by the pair-wise split relocations à la IMAGE_REL_ARM_MOV32Tfor PE/COFF

The hints are there so that the linker can turn (non-adjacent) ADRP/ADD sequences, and similar, into ADR/NOP if the referenced symbol ends up close enough; this saves a cycle or so on Apple CPUs. To do that the compiler marks instruction-pairs used to generate a single address and saves that data off in a special MachO load command. I suppose it is sort of a souped-up relocation which specifies two addresses to be relocated instead of just one.

In principle someone could come up with an ELF section type to embed the data and add support to one of those linkers; but no-one has yet.