summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2018-09-26 20:50:39 +0000
committerRyan Prichard <rprichard@google.com>2018-09-26 20:50:39 +0000
commited5bb932a202dd5ede1cb70a032f094b35bbd176 (patch)
treee5ab993c529910279c1af8bdb9f57caf616ba12a
parentb7c8d2d405fb418e1c02004a8be3e541383ac2a1 (diff)
downloadbcm5719-llvm-ed5bb932a202dd5ede1cb70a032f094b35bbd176.tar.gz
bcm5719-llvm-ed5bb932a202dd5ede1cb70a032f094b35bbd176.zip
Allow later -z name=<int> args to override earlier args
Summary: lld already gives later -z options precedence in getZFlag(). This matches the behavior of ld.bfd and ld.gold, where later options override earlier ones. (I tested with -z max-page-size and -z stack-size.) Reviewers: ruiu, espindola, grimar Reviewed By: ruiu, grimar Subscribers: grimar, emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D52526 llvm-svn: 343145
-rw-r--r--lld/Common/Args.cpp2
-rw-r--r--lld/test/ELF/zstack-size.s3
2 files changed, 4 insertions, 1 deletions
diff --git a/lld/Common/Args.cpp b/lld/Common/Args.cpp
index 854b50a1783..3f0671d72a6 100644
--- a/lld/Common/Args.cpp
+++ b/lld/Common/Args.cpp
@@ -41,7 +41,7 @@ std::vector<StringRef> lld::args::getStrings(opt::InputArgList &Args, int Id) {
uint64_t lld::args::getZOptionValue(opt::InputArgList &Args, int Id,
StringRef Key, uint64_t Default) {
- for (auto *Arg : Args.filtered(Id)) {
+ for (auto *Arg : Args.filtered_reverse(Id)) {
std::pair<StringRef, StringRef> KV = StringRef(Arg->getValue()).split('=');
if (KV.first == Key) {
uint64_t Result = Default;
diff --git a/lld/test/ELF/zstack-size.s b/lld/test/ELF/zstack-size.s
index 23eed0a79ec..bec2b2057fb 100644
--- a/lld/test/ELF/zstack-size.s
+++ b/lld/test/ELF/zstack-size.s
@@ -6,6 +6,9 @@
# RUN: ld.lld -z stack-size=0 %t -o %t2
# RUN: llvm-readobj -program-headers %t2 | FileCheck %s -check-prefix=CHECK2
+# RUN: ld.lld -z stack-size=0x2000 -z stack-size=0x1000 %t -o %t3
+# RUN: llvm-readobj -program-headers %t3 | FileCheck %s -check-prefix=CHECK1
+
.global _start
_start:
nop
OpenPOWER on IntegriCloud