This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Implement .variant_pcs directive
ClosedPublic

Authored by c-rhodes on Oct 9 2020, 9:03 AM.

Details

Summary

A dynamic linker with lazy binding support may need to handle variant
PCS function symbols specially, so an ELF symbol table marking
STO_AARCH64_VARIANT_PCS [1] was added to address this.

Function symbols that follow the vector PCS are marked via the
.variant_pcs assembler directive, which takes a single parameter
specifying the symbol name and sets the STO_AARCH64_VARIANT_PCS st_other
flag in the object file.

[1] https://github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst#st-other-values

Diff Detail

Event Timeline

c-rhodes created this revision.Oct 9 2020, 9:03 AM
c-rhodes requested review of this revision.Oct 9 2020, 9:03 AM
sdesmalen added inline comments.Oct 9 2020, 10:14 AM
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
797

nit: auto ?

801

Should this branch also call emitFunctionEntryLabel() ?

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
5672

Should this give an error?

llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
50

nit: const MCSymbol *Symbol

llvm/test/CodeGen/AArch64/variant-pcs.ll
54

nit: I think this test can be removed, as we want to remove aarch64_sve_vector_pcs (because it is implied by the operands to the function when using the default cc).

c-rhodes updated this revision to Diff 297531.Oct 12 2020, 3:20 AM

Address Sander's comments

c-rhodes marked 3 inline comments as done.Oct 12 2020, 3:31 AM
c-rhodes added inline comments.
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
801

Should this branch also call emitFunctionEntryLabel() ?

I've removed OutStreamer->emitLabel(CurrentFnSym); and deferred it to emitFunctionEntryLabel since the latter errors if the label has already been emitted.

llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
50

nit: const MCSymbol *Symbol

emitDirectiveVariantPCS is defined by the AArch64TargetStreamer interface which the asm/elf streamers are based on and the latter modifies the symbol so it can't be const.

This revision is now accepted and ready to land.Oct 12 2020, 7:58 AM
This revision was automatically updated to reflect the committed changes.
c-rhodes marked an inline comment as done.