aboutsummaryrefslogtreecommitdiff
path: root/gold/script-sections.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2008-04-15 22:50:37 +0000
committerIan Lance Taylor <ian@airs.com>2008-04-15 22:50:37 +0000
commite6188289b9a48047e47a8d47cd812bbcc75db554 (patch)
treebebebbfecdff778e8bfca117c30de83b32c86b14 /gold/script-sections.cc
parent4f2a9edd9c29db95518668e73369d590ecf6984b (diff)
downloadgdb-e6188289b9a48047e47a8d47cd812bbcc75db554.zip
gdb-e6188289b9a48047e47a8d47cd812bbcc75db554.tar.gz
gdb-e6188289b9a48047e47a8d47cd812bbcc75db554.tar.bz2
* script-sections.cc (Script_sections::create_segments): Use
header_size_adjustment even when there is enough room for the headers. * testsuite/script_test_4.sh: New file. * testsuite/script_test_4.t: New file. * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh. (check_DATA): Add script_test_4.stdout. (MOSTLYCLEANFILES): Likewise. (script_test_4): New target. (script_test_4.stdout): New target. * testsuite/Makefile.in: Rebuild.
Diffstat (limited to 'gold/script-sections.cc')
-rw-r--r--gold/script-sections.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index f6b6550..55db831 100644
--- a/gold/script-sections.cc
+++ b/gold/script-sections.cc
@@ -2706,18 +2706,17 @@ Script_sections::create_segments(Layout* layout)
size_t sizeof_headers = this->total_header_size(layout);
- if ((first_seg->paddr() & (abi_pagesize - 1)) >= sizeof_headers)
- {
- first_seg->set_addresses(first_seg->vaddr() - sizeof_headers,
- first_seg->paddr() - sizeof_headers);
- return first_seg;
- }
-
uint64_t vma = first_seg->vaddr();
uint64_t lma = first_seg->paddr();
uint64_t subtract = this->header_size_adjustment(lma, sizeof_headers);
+ if ((lma & (abi_pagesize - 1)) >= sizeof_headers)
+ {
+ first_seg->set_addresses(vma - subtract, lma - subtract);
+ return first_seg;
+ }
+
// If there is no room to squeeze in the headers, then punt. The
// resulting executable probably won't run on GNU/Linux, but we
// trust that the user knows what they are doing.