path: root/Documentation/asm-annotations.rst
diff options
authorNick Desaulniers <>2021-01-12 11:46:24 -0800
committerBorislav Petkov <>2021-01-14 17:18:25 +0100
commit5e6dca82bcaa49348f9e5fcb48df4881f6d6c4ae (patch)
treea04ed97a7888347804f1e9a4c2cf61fa62dc6ad9 /Documentation/asm-annotations.rst
parent7c53f6b671f4aba70ff15e1b05148b10d58c2837 (diff)
x86/entry: Emit a symbol for register restoring thunk
Arnd found a randconfig that produces the warning: arch/x86/entry/thunk_64.o: warning: objtool: missing symbol for insn at offset 0x3e when building with LLVM_IAS=1 (Clang's integrated assembler). Josh notes: With the LLVM assembler not generating section symbols, objtool has no way to reference this code when it generates ORC unwinder entries, because this code is outside of any ELF function. The limitation now being imposed by objtool is that all code must be contained in an ELF symbol. And .L symbols don't create such symbols. So basically, you can use an .L symbol *inside* a function or a code segment, you just can't use the .L symbol to contain the code using a SYM_*_START/END annotation pair. Fangrui notes that this optimization is helpful for reducing image size when compiling with -ffunction-sections and -fdata-sections. I have observed on the order of tens of thousands of symbols for the kernel images built with those flags. A patch has been authored against GNU binutils to match this behavior of not generating unused section symbols ([1]), so this will also become a problem for users of GNU binutils once they upgrade to 2.36. Omit the .L prefix on a label so that the assembler will emit an entry into the symbol table for the label, with STB_LOCAL binding. This enables objtool to generate proper unwind info here with LLVM_IAS=1 or GNU binutils 2.36+. [ bp: Massage commit message. ] Reported-by: Arnd Bergmann <> Suggested-by: Josh Poimboeuf <> Suggested-by: Borislav Petkov <> Suggested-by: Mark Brown <> Signed-off-by: Nick Desaulniers <> Signed-off-by: Borislav Petkov <> Acked-by: Peter Zijlstra (Intel) <> Acked-by: Josh Poimboeuf <> Link: Link: Link: Link: Link:;a=commit;h=d1bcae833b32f1408485ce69f844dcd7ded093a8 [1]
Diffstat (limited to 'Documentation/asm-annotations.rst')
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/asm-annotations.rst b/Documentation/asm-annotations.rst
index 32ea57483378..76424e0431f4 100644
--- a/Documentation/asm-annotations.rst
+++ b/Documentation/asm-annotations.rst
@@ -100,6 +100,11 @@ Instruction Macros
This section covers ``SYM_FUNC_*`` and ``SYM_CODE_*`` enumerated above.
+``objtool`` requires that all code must be contained in an ELF symbol. Symbol
+names that have a ``.L`` prefix do not emit symbol table entries. ``.L``
+prefixed symbols can be used within a code region, but should be avoided for
+denoting a range of code via ``SYM_*_START/END`` annotations.
* ``SYM_FUNC_START`` and ``SYM_FUNC_START_LOCAL`` are supposed to be **the
most frequent markings**. They are used for functions with standard calling
conventions -- global and local. Like in C, they both align the functions to