aboutsummaryrefslogtreecommitdiff
path: root/gold/target.h
diff options
context:
space:
mode:
Diffstat (limited to 'gold/target.h')
-rw-r--r--gold/target.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/gold/target.h b/gold/target.h
index 8e801e1..51402c2 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -119,9 +119,19 @@ class Target
{ return this->pti_->dynamic_linker; }
// Return the default address to use for the text segment.
+ // If a -z max-page-size argument has set the ABI page size
+ // to a value larger than the default starting address,
+ // bump the starting address up to the page size, to avoid
+ // misaligning the text segment in the file.
uint64_t
default_text_segment_address() const
- { return this->pti_->default_text_segment_address; }
+ {
+ uint64_t addr = this->pti_->default_text_segment_address;
+ uint64_t pagesize = this->abi_pagesize();
+ if (addr < pagesize)
+ addr = pagesize;
+ return addr;
+ }
// Return the ABI specified page size.
uint64_t