Don't try to compute a value that is known to fail.

We try to evaluate expressions early when possible, but it is not
possible to evaluate them early if they are based on a section.

Before we would get this wrong on ABSOLUTE expressions.

llvm-svn: 313764
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 908ebe5..b717067 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -87,7 +87,7 @@
   // We want to set symbol values early if we can. This allows us to use symbols
   // as variables in linker scripts. Doing so allows us to write expressions
   // like this: `alignment = 16; . = ALIGN(., alignment)`
-  uint64_t SymValue = Value.isAbsolute() ? Value.getValue() : 0;
+  uint64_t SymValue = Value.Sec ? 0 : Value.getValue();
   replaceBody<DefinedRegular>(Sym, nullptr, Cmd->Name, /*IsLocal=*/false,
                               Visibility, STT_NOTYPE, SymValue, 0, Sec);
   return Sym->body();
diff --git a/lld/test/ELF/linkerscript/early-assign-symbol.s b/lld/test/ELF/linkerscript/early-assign-symbol.s
index cc8394b..e2e9175 100644
--- a/lld/test/ELF/linkerscript/early-assign-symbol.s
+++ b/lld/test/ELF/linkerscript/early-assign-symbol.s
@@ -12,6 +12,10 @@
 
 # CHECK: error: {{.*}}.script:1: unable to evaluate expression: input section .text has no output section assigned
 
+# Simple case that we can handle.
+# RUN: echo "SECTIONS { aaa = ABSOLUTE(foo); .text  : { *(.text*) } }" > %t4.script
+# RUN: ld.lld -o %t --script %t4.script %t.o
+
 .section .text
 .globl foo
 foo: