Mark the $local function begin symbol as a function
authorAlex Richardson <alexrichardson@google.com>
Thu, 25 Aug 2022 12:15:47 +0000 (12:15 +0000)
committerAlex Richardson <alexrichardson@google.com>
Fri, 26 Aug 2022 09:34:04 +0000 (09:34 +0000)
commit0483b008759b566984f040269b7a90210922a145
treeff64263ace4c78cc34329bce1e5e6ac96fc2a153
parent5955edf8a453b4b8ff7d5dfff2db3adc27a36bc1
Mark the $local function begin symbol as a function

While this does not matter for most targets, when building for Arm Morello,
we have to mark the symbol as a function and add size information, so that
LLD can correctly evaluate relocations against the local symbol.
Since Morello is an out-of-tree target, I tried to reproduce this with
in-tree backends and with the previous reviews applied this results in
a noticeable difference when targeting Thumb.

Background: Morello uses a method similar Thumb where the encoding mode is
specified in the LSB of the symbol. If we don't mark the target as a
function, the relocation will not have the LSB set and calls will end up
using the wrong encoding mode (which will almost certainly crash).

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D131429
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/test/CodeGen/AArch64/elf-preemption.ll
llvm/test/CodeGen/AArch64/semantic-interposition-asm.ll
llvm/test/CodeGen/ARM/dso-local-func.ll
llvm/test/CodeGen/ARM/thumb-function-section-reloc.ll
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_generated_funcs.ll.generated.expected
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_generated_funcs.ll.nogenerated.expected
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_generated_funcs.ll.generated.expected
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_generated_funcs.ll.nogenerated.expected
llvm/utils/UpdateTestChecks/asm.py