forked from OSchip/llvm-project
Allow expressions in MEMORY command.
Previously, we allowed only integers in this context. Now you can write expressions there. LLD is now able to handle the following linker, for example. MEMORY { rom (rx) : ORIGIN = (1024 * 1024) } llvm-svn: 300131
This commit is contained in:
parent
e9c9edf67b
commit
040af7deab
|
@ -1102,12 +1102,7 @@ uint64_t ScriptParser::readMemoryAssignment(StringRef S1, StringRef S2,
|
|||
return 0;
|
||||
}
|
||||
expect("=");
|
||||
|
||||
// TODO: Fully support constant expressions.
|
||||
if (Optional<uint64_t> Val = parseInt(next()))
|
||||
return *Val;
|
||||
setError("nonconstant expression for " + S1);
|
||||
return 0;
|
||||
return readExpr()().getValue();
|
||||
}
|
||||
|
||||
// Parse the MEMORY command as specified in:
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
# RUN: echo "MEMORY { \
|
||||
# RUN: ram (rwx) : ORIGIN = 0, LENGTH = 1024M \
|
||||
# RUN: rom (rx) : org = 0x80000000, len = 64M \
|
||||
# RUN: rom (rx) : org = (0x80 * 0x1000 * 0x1000), len = 64M \
|
||||
# RUN: } \
|
||||
# RUN: SECTIONS { \
|
||||
# RUN: .text : { *(.text) } > rom \
|
||||
|
|
Loading…
Reference in New Issue