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
This commit is contained in:
Rafael Espindola
2017-12-22 21:55:28 +00:00
parent d8e3633db4
commit 9cbb6dd1fc
2 changed files with 8 additions and 0 deletions

View File

@@ -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};
}