[all-commits] [llvm/llvm-project] 271865: [MC] Support .cfi_label

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Jul 7 12:41:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2718654c542c742e2dd18dcda8b93de1d4d3b640
      https://github.com/llvm/llvm-project/commit/2718654c542c742e2dd18dcda8b93de1d4d3b640
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-07-07 (Sun, 07 Jul 2024)

  Changed paths:
    M bolt/lib/Core/BinaryFunction.cpp
    M llvm/include/llvm/MC/MCDwarf.h
    M llvm/include/llvm/MC/MCStreamer.h
    M llvm/lib/CodeGen/CFIInstrInserter.cpp
    M llvm/lib/MC/MCAsmStreamer.cpp
    M llvm/lib/MC/MCDwarf.cpp
    M llvm/lib/MC/MCParser/AsmParser.cpp
    M llvm/lib/MC/MCStreamer.cpp
    A llvm/test/MC/ELF/cfi-label.s

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list