[lld] r362770 - [lld] Allow args::getInterger to parse args larger than 2^31-1
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 23:05:26 PDT 2019
Author: sbc
Date: Thu Jun 6 23:05:26 2019
New Revision: 362770
URL: http://llvm.org/viewvc/llvm-project?rev=362770&view=rev
Log:
[lld] Allow args::getInterger to parse args larger than 2^31-1
Differential Revision: https://reviews.llvm.org/D62933
Added:
lld/trunk/test/wasm/large-memory.test
Modified:
lld/trunk/Common/Args.cpp
lld/trunk/include/lld/Common/Args.h
Modified: lld/trunk/Common/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/Common/Args.cpp?rev=362770&r1=362769&r2=362770&view=diff
==============================================================================
--- lld/trunk/Common/Args.cpp (original)
+++ lld/trunk/Common/Args.cpp Thu Jun 6 23:05:26 2019
@@ -26,12 +26,13 @@ CodeGenOpt::Level lld::args::getCGOptLev
return CodeGenOpt::Default;
}
-int lld::args::getInteger(opt::InputArgList &Args, unsigned Key, int Default) {
+int64_t lld::args::getInteger(opt::InputArgList &Args, unsigned Key,
+ int64_t Default) {
auto *A = Args.getLastArg(Key);
if (!A)
return Default;
- int V;
+ int64_t V;
if (to_integer(A->getValue(), V, 10))
return V;
Modified: lld/trunk/include/lld/Common/Args.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Common/Args.h?rev=362770&r1=362769&r2=362770&view=diff
==============================================================================
--- lld/trunk/include/lld/Common/Args.h (original)
+++ lld/trunk/include/lld/Common/Args.h Thu Jun 6 23:05:26 2019
@@ -25,7 +25,8 @@ namespace args {
llvm::CodeGenOpt::Level getCGOptLevel(int OptLevelLTO);
-int getInteger(llvm::opt::InputArgList &Args, unsigned Key, int Default);
+int64_t getInteger(llvm::opt::InputArgList &Args, unsigned Key,
+ int64_t Default);
std::vector<StringRef> getStrings(llvm::opt::InputArgList &Args, int Id);
Added: lld/trunk/test/wasm/large-memory.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/wasm/large-memory.test?rev=362770&view=auto
==============================================================================
--- lld/trunk/test/wasm/large-memory.test (added)
+++ lld/trunk/test/wasm/large-memory.test Thu Jun 6 23:05:26 2019
@@ -0,0 +1,5 @@
+RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o
+
+; Verify we can parse large integers such as when we ask for 2G of total
+; memory.
+RUN: wasm-ld %t.o -o %t.wasm --max-memory=2147483648
More information about the llvm-commits
mailing list