http://sourceware.org/bugzilla/show_bug.cgi?id=14566
Bug #: 14566 Summary: wrongly aligned segments when -z max-page-size does not match -z common-page-size Product: binutils Version: 2.24 (HEAD) Status: NEW Severity: normal Priority: P2 Component: gold AssignedTo: i...@airs.com ReportedBy: amo...@gmail.com CC: ccout...@google.com Classification: Unclassified Seen on powerpc with current default max-page-size of 64k and common-page-size of 4k. Testsuite results contain ============================ 39 of 136 tests failed See testsuite/test-suite.log ============================ These are all segmentation faults on trying to execute the very first instruction at _start, due to page protection being set to RW rather than RE. If I change the default common-page-size to 64k, then I get only 6 failures. "Good" basic_test load segments for powerpc64 are LOAD 0x000000 0x0000000010000000 0x0000000010000000 0x001c78 0x001c78 R E 0x10000 LOAD 0x001c78 0x0000000010011c78 0x0000000010011c78 0x000608 0x0006b0 RW 0x10000 Bad ones are LOAD 0x000000 0x0000000010000000 0x0000000010000000 0x001c78 0x001c78 R E 0x10000 LOAD 0x002000 0x0000000010002000 0x0000000010002000 0x000608 0x0006b0 RW 0x10000 Note how vaddr for the bad second segment starts inside the abi page of the first segment. It should be at 0x100012000. The problem appears to be code in layout.cc after this comment. // Now that we know the size of this segment, we may be able // to save a page in memory, at the cost of wasting some // file space, by instead aligning to the start of a new // page. Here we use the real machine page size rather than // the ABI mandated page size. If the segment has been // aligned so that the relro data ends at a page boundary, // we do not try to realign it. -z common-page-size shouldn't ever result in a segment starting at a lower address than what it would with common-page-size equal to max-page-size. Normally, a RW segment following a RO segment starts on the next max-page-size page at the same page offset as the RO segment finished. That results in minimum file size. However it is sometimes advantageous to start the RW segment at a higher common-page-size aligned address, trading a somewhat larger file for a smaller number of actual in-memory pages. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils