Skip to content

Commit ac5ebe8

Browse files
committed
silence symbol overrides
Linker produces warnings for symbol overrides from linker script. Notify the user with -Wlinker-script, instead of producing this warning by default. Several users build images using --fatal-warnings, and these warnings prevent the build from being succesful. Fixes (qualcomm#145) Change-Id: I2336ffc93859040daa18f3f2630fca3dea63a3f0 Signed-off-by: Shankar Easwaran <[email protected]>
1 parent 3762207 commit ac5ebe8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/SymbolResolver/IRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ LDSymbol *IRBuilder::addSymbol<IRBuilder::Force, IRBuilder::Unresolve>(
515515
} else {
516516
// the symbol is already in the pool, override it
517517
ResolveInfo OldInfo;
518-
if (!Info->isUndef())
518+
if (ThisConfig.showLinkerScriptWarnings() && !Info->isUndef())
519519
ThisConfig.raise(Diag::warning_override_symbol)
520520
<< SymbolName << Input->getInput()->decoratedPath()
521521
<< Info->getResolvedPath();

test/Common/standalone/MultipleDefinitions/MultipleDefinitions.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ RUN: %clang %clangopts -o %t1.2.o -c %p/Inputs/2.c -ffunction-sections
1212
# Override symbols Defsym expressions
1313
#
1414
RUN: %clang %clangopts -o %t1.1.o -c %p/Inputs/1.c -ffunction-sections
15-
RUN: %link %linkopts %t1.1.o --defsym v=200 -o %t2.out 2>&1 | %filecheck %s -check-prefix=WARNDEF
15+
RUN: %link %linkopts -Wlinker-script %t1.1.o --defsym v=200 -o %t2.out 2>&1 | %filecheck %s -check-prefix=WARNDEF
1616
#WARNDEF: Warning: Symbol v defined in Expression(Defsym)v=200 overrides symbol in
1717

1818
#
1919
# Check that linker script assignments are processed in link order
2020
#
21-
RUN: %link %linkopts %t1.1.o --defsym v=100 -o %t2.out.2 -T %p/Inputs/s.t 2>&1 | %filecheck %s -check-prefix=DEFSYMSCRIPT
22-
RUN: %link %linkopts %t1.1.o --defsym v=100 -o %t2.out.3 %p/Inputs/s.t 2>&1 | %filecheck %s -check-prefix=DEFSYMSCRIPT
21+
RUN: %link %linkopts -Wlinker-script %t1.1.o --defsym v=100 -o %t2.out.2 -T %p/Inputs/s.t 2>&1 | %filecheck %s -check-prefix=DEFSYMSCRIPT
22+
RUN: %link %linkopts -Wlinker-script %t1.1.o --defsym v=100 -o %t2.out.3 %p/Inputs/s.t 2>&1 | %filecheck %s -check-prefix=DEFSYMSCRIPT
2323
#DEFSYMSCRIPT: Warning: Symbol v defined in Expression(Defsym)v=100 overrides symbol in {{.*}}1.o
2424

2525

2626
#
2727
# Check that linker script assignment definitions are processed after all object
2828
# files are processed
2929
#
30-
RUN: %not %link %linkopts %t1.1.o --defsym v=100 -T %p/Inputs/s.t %t1.2.o 2>&1 | %filecheck %s -check-prefix=MULDEF
30+
RUN: %not %link %linkopts -Wlinker-script %t1.1.o --defsym v=100 -T %p/Inputs/s.t %t1.2.o 2>&1 | %filecheck %s -check-prefix=MULDEF
3131
#MULDEF: Error: multiple definition of symbol `v' in file {{.*}}1.o and {{.*}}2.o
3232

3333
#END_TEST

0 commit comments

Comments
 (0)