[PATCH] D155989: [LLD][ELF] Warn on invalid local symbols
Vincent Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 21 13:06:16 PDT 2023
thevinster created this revision.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: MaskRay.
Herald added a project: All.
thevinster edited the summary of this revision.
thevinster added a reviewer: smeenai.
thevinster published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Some of our apps are failing to link properly with third-party libraries
because this warning has been converted to an error. In principle, we
shouldn't allow this sort of behavior, but I don't see any reasons for
error-ing since it hasn't caused any real issues for us in the past. For
those who wish to keep it as an error, users may provide `-fatal-warnings`
to keep the existing behavior.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155989
Files:
lld/ELF/InputFiles.cpp
lld/test/ELF/invalid-local-symbol-in-dso.s
lld/test/ELF/invalid/undefined-local-symbol-in-dso.test
Index: lld/test/ELF/invalid/undefined-local-symbol-in-dso.test
===================================================================
--- lld/test/ELF/invalid/undefined-local-symbol-in-dso.test
+++ lld/test/ELF/invalid/undefined-local-symbol-in-dso.test
@@ -5,12 +5,12 @@
# symbol with an index >= the sh_info of the dynamic symbol table section). Such
# a DSO is very broken, because local symbols should precede all global symbols
# in the symbol table, and because having a symbol that's both undefined and
-# STB_LOCAL is a nonsensical combination. Nevertheless, we should error on such
+# STB_LOCAL is a nonsensical combination. Nevertheless, we should warn on such
# input files instead of crashing.
# RUN: yaml2obj %s -o %t.so
-# RUN: not ld.lld %t.so -o /dev/null 2>&1 | FileCheck %s
-# CHECK: error: {{.*}}.so: invalid local symbol 'foo' in global part of symbol table
+# RUN: ld.lld %t.so -o /dev/null 2>&1 | FileCheck %s
+# CHECK: warning: {{.*}}.so: invalid local symbol 'foo' in global part of symbol table
--- !ELF
FileHeader:
Index: lld/test/ELF/invalid-local-symbol-in-dso.s
===================================================================
--- lld/test/ELF/invalid-local-symbol-in-dso.s
+++ lld/test/ELF/invalid-local-symbol-in-dso.s
@@ -1,8 +1,8 @@
# REQUIRES: x86
# We used to crash on this
-# RUN: not ld.lld %p/Inputs/local-symbol-in-dso.so -o /dev/null 2>&1 | FileCheck %s
-# CHECK: error: {{.*}}local-symbol-in-dso.so: invalid local symbol 'foo' in global part of symbol table
+# RUN: ld.lld %p/Inputs/local-symbol-in-dso.so -o /dev/null 2>&1 | FileCheck %s
+# CHECK: warning: {{.*}}local-symbol-in-dso.so: invalid local symbol 'foo' in global part of symbol table
# RUN: llvm-mc %s -o %t.o -filetype=obj -triple x86_64-pc-linux
# RUN: not ld.lld %t.o %p/Inputs/local-symbol-in-dso.so -o /dev/null
Index: lld/ELF/InputFiles.cpp
===================================================================
--- lld/ELF/InputFiles.cpp
+++ lld/ELF/InputFiles.cpp
@@ -1484,7 +1484,7 @@
// symbol, that's a violation of the spec.
StringRef name = CHECK(sym.getName(stringTable), this);
if (sym.getBinding() == STB_LOCAL) {
- errorOrWarn(toString(this) + ": invalid local symbol '" + name +
+ warn(toString(this) + ": invalid local symbol '" + name +
"' in global part of symbol table");
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155989.543030.patch
Type: text/x-patch
Size: 2381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230721/aa1b3361/attachment.bin>
More information about the llvm-commits
mailing list