diff --git a/lld/Common/Args.cpp b/lld/Common/Args.cpp --- a/lld/Common/Args.cpp +++ b/lld/Common/Args.cpp @@ -26,12 +26,13 @@ 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; diff --git a/lld/include/lld/Common/Args.h b/lld/include/lld/Common/Args.h --- a/lld/include/lld/Common/Args.h +++ b/lld/include/lld/Common/Args.h @@ -25,7 +25,8 @@ 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 getStrings(llvm::opt::InputArgList &Args, int Id); diff --git a/lld/test/wasm/large-memory.test b/lld/test/wasm/large-memory.test new file mode 100644 --- /dev/null +++ b/lld/test/wasm/large-memory.test @@ -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