summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-12-22 21:55:28 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-12-22 21:55:28 +0000
commit9cbb6dd1fcf59a14be4f924b9faca90bbb11dfcb (patch)
treecc3f2ac15965839414de29dc00f6335f65db5695 /lld/ELF/ScriptParser.cpp
parentd8e3633db438c3e555c53b6e50f42029e0eabe39 (diff)
downloadbcm5719-llvm-9cbb6dd1fcf59a14be4f924b9faca90bbb11dfcb.tar.gz
bcm5719-llvm-9cbb6dd1fcf59a14be4f924b9faca90bbb11dfcb.zip
Result of subtracting two symbols should be absolute.
When two linker script symbols are subtracted, the result should be absolute. This is the behavior of binutils' ld. Patch by Erick Reyes! llvm-svn: 321390
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index d56500ae7dd..c1176ccfa8d 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -151,6 +151,8 @@ static ExprValue add(ExprValue A, ExprValue B) {
}
static ExprValue sub(ExprValue A, ExprValue B) {
+ if (!A.isAbsolute() && !B.isAbsolute())
+ return A.getValue() - B.getValue();
return {A.Sec, false, A.getSectionOffset() - B.getValue(), A.Loc};
}
OpenPOWER on IntegriCloud