diff options
author | Fangrui Song <i@maskray.me> | 2024-07-07 12:41:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-07 12:41:13 -0700 |
commit | 2718654c542c742e2dd18dcda8b93de1d4d3b640 (patch) | |
tree | b9646a7fa5aea75d3e78c3921a7a5bdf2edaf2e6 /llvm/lib/MC/MCDwarf.cpp | |
parent | f13463ee52cf95c76867d0dafe6bff16cb9e3009 (diff) | |
download | llvm-2718654c542c742e2dd18dcda8b93de1d4d3b640.zip llvm-2718654c542c742e2dd18dcda8b93de1d4d3b640.tar.gz llvm-2718654c542c742e2dd18dcda8b93de1d4d3b640.tar.bz2 |
[MC] Support .cfi_label
GNU assembler 2.26 introduced the .cfi_label directive. It does not
expand to any CFI instructions, but defines a label in
.eh_frame/.debug_frame, which can be used by runtime patching code to
locate the FDE. .cfi_label is not allowed for CIE's initial
instructions, and can therefore be used to force the next instruction to
be placed in a FDE instead of a CIE.
In glibc since 2018, sysdeps/riscv/start.S utilizes .cfi_label to force
DW_CFA_undefined to be placed in a FDE. arc/csky/loongarch ports have
copied this use.
```
.cfi_startproc
// DW_CFA_undefined is allowed for CIE's initial instructions.
// Without .cfi_label, gas would place DW_CFA_undefined in a CIE.
.cfi_label .Ldummy
.cfi_undefined ra
.cfi_endproc
```
No CFI instruction is associated with .cfi_label, so the `case
MCCFIInstruction::OpLabel:` code in BOLT is unreachable and onlt to make
-Wswitch happy.
Close #97222
Pull Request: https://github.com/llvm/llvm-project/pull/97922
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index 321a66e..efafd55 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -1465,6 +1465,9 @@ void FrameEmitterImpl::emitCFIInstruction(const MCCFIInstruction &Instr) { case MCCFIInstruction::OpEscape: Streamer.emitBytes(Instr.getValues()); return; + case MCCFIInstruction::OpLabel: + Streamer.emitLabel(Instr.getCfiLabel(), Instr.getLoc()); + return; } llvm_unreachable("Unhandled case in switch"); } |