Skip to content

Commit

Permalink
[lld] Allow args::getInterger to parse args larger than 2^31-1
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D62933

llvm-svn: 362770
  • Loading branch information
sbc100 committed Jun 7, 2019
1 parent fd54fa5 commit 53211aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lld/Common/Args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ CodeGenOpt::Level lld::args::getCGOptLevel(int OptLevelLTO) {
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;

Expand Down
3 changes: 2 additions & 1 deletion lld/include/lld/Common/Args.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions lld/test/wasm/large-memory.test
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 53211aa

Please sign in to comment.