[PATCH] D98762: [LTO][MC] Discard non-prevailing defined symbols in module-level assembly

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 18 13:19:08 PDT 2021


MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/MC/MCParser/AsmParser.cpp:5837
+///  ::= ".lto_discard" [ identifier ( , identifier )* ]
+/// This directive bears two meanings: a module inlineasm start marker and
+/// gives a list of symbols that are to be discarded.
----------------
The LTO library emits this directive to discard non-prevailing symbols. We ignore symbol assignments and attribute changes for the specified symbols.


================
Comment at: llvm/lib/MC/MCParser/AsmParser.cpp:5844
+    if (parseIdentifier(Name))
+      return Error(Loc, "expected identifier");
+    LTODiscardSymbols.insert(Name);
----------------
You can add a `--defsym=ERR=1` RUN line to the `test/MC/ELF` test to check the diagnostic message and position. See `relocation-alias.s` and ``reloc-directive.s` for examples.


================
Comment at: llvm/test/LTO/X86/inline-asm-lto-discard2.ll:5
+; 2. there is no reassignment error in the presence of ".lto_discard"
+; RUN: llc -filetype=asm < %s | FileCheck %s
+
----------------
Nit: `-filetype=asm` is the default. Delete


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98762/new/

https://reviews.llvm.org/D98762



More information about the llvm-commits mailing list