[PATCH] D86142: [LLD] Search archives for non-tentative defintions.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 9 13:11:54 PST 2020
MaskRay added inline comments.
================
Comment at: lld/ELF/InputFiles.cpp:1240
+// The handling of tentative definitions (COMMON symbols) in archives is murky.
+// A tetative defintion will be promoted to a global definition if there are no
+// non-tentative definitions to dominate it. When we hold a tentative definition
----------------
typo: tentative
================
Comment at: lld/ELF/InputFiles.cpp:1249
+// definition. An archive member would only be included if it satisfies some
+// other undefined symbol. This is the behavior GOLD uses.
+//
----------------
GOLD -> Gold or gold
================
Comment at: lld/ELF/InputFiles.cpp:1254
+// The linker searches archive memebers for global or weak definitions to
+// replace the tentative definition with. This is the behavior used by BFD.
+//
----------------
BFD-> GNU ld
================
Comment at: lld/ELF/Options.td:68
+defm fortran_common : BB<"fortran-common",
+ "Search archive members for defintions to override COMMON symbols (default)",
+ " Do not search archive members for defintions to override COMMON symbols">;
----------------
================
Comment at: lld/ELF/Options.td:69
+ "Search archive members for defintions to override COMMON symbols (default)",
+ " Do not search archive members for defintions to override COMMON symbols">;
+
----------------
================
Comment at: lld/ELF/Symbols.cpp:698
+static void replaceCommon(Symbol &oldSym, const LazyT &newSym) {
+ backwardReferences.erase(&oldSym);
+ oldSym.replace(newSym);
----------------
Do you have a `--warn-backrefs` test for `backwardReferences.erase(&oldSym);` ?
================
Comment at: lld/test/ELF/common-archive-lookup.s:7
+
+# Object files.
+# RUN: llvm-mc -triple=powerpc64le -filetype=obj ref.s -o %t1.o
----------------
##
================
Comment at: lld/test/ELF/common-archive-lookup.s:20
+
+# Bitcode files.
+# RUN: llvm-as -o %t1.bc commonblock.ll
----------------
##
================
Comment at: lld/test/ELF/common-archive-lookup.s:112
+
+# Tentative definition of 'block'.
+ .comm block,40,8
----------------
##
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86142/new/
https://reviews.llvm.org/D86142
More information about the llvm-commits
mailing list