[lld] r343145 - Allow later -z name=<int> args to override earlier args
Ryan Prichard via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 26 13:50:39 PDT 2018
Author: rprichard
Date: Wed Sep 26 13:50:39 2018
New Revision: 343145
URL: http://llvm.org/viewvc/llvm-project?rev=343145&view=rev
Log:
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
Modified:
lld/trunk/Common/Args.cpp
lld/trunk/test/ELF/zstack-size.s
Modified: lld/trunk/Common/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/Common/Args.cpp?rev=343145&r1=343144&r2=343145&view=diff
==============================================================================
--- lld/trunk/Common/Args.cpp (original)
+++ lld/trunk/Common/Args.cpp Wed Sep 26 13:50:39 2018
@@ -41,7 +41,7 @@ std::vector<StringRef> lld::args::getStr
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;
Modified: lld/trunk/test/ELF/zstack-size.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/zstack-size.s?rev=343145&r1=343144&r2=343145&view=diff
==============================================================================
--- lld/trunk/test/ELF/zstack-size.s (original)
+++ lld/trunk/test/ELF/zstack-size.s Wed Sep 26 13:50:39 2018
@@ -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
More information about the llvm-commits
mailing list