[lld] [MTE] [lld] Don't tag symbols in sections with implicit start/stop (PR #73531)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 21:44:08 PST 2023


================
@@ -999,6 +999,18 @@ addTaggedSymbolReferences(InputSectionBase &sec,
     // like functions or TLS symbols.
     if (sym.type != STT_OBJECT)
       continue;
+    // Global variables can be explicitly put into sections where the section
+    // name is a valid C identifier. In these cases, the linker will create
+    // implicit __start and __stop symbols for the section. Globals that are in
----------------
MaskRay wrote:

The description is inaccurate: __start_/__stop_ are only defined when used. This sentence reads as the linker always defines the symbols.

Suggest: For a global variable placed in a section whose name is a valid C identifier, it's possible that the variable may be accessed using addStartStopSymbols defined symbols. The start/stop symbols are untagged, so the global variable should be untagged as well.

https://github.com/llvm/llvm-project/pull/73531


More information about the llvm-commits mailing list