diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-01-11 19:04:55 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-01-11 19:05:06 -0800 |
commit | 2888249fc9eb38b6d6e4bd969ce63c26e3753d5e (patch) | |
tree | 83cb93b8dbae33130cc655bee72ef8c2ef982d04 /bfd/ChangeLog | |
parent | 47acac12c83f173481debc64618626b50ecf7498 (diff) | |
download | gdb-2888249fc9eb38b6d6e4bd969ce63c26e3753d5e.zip gdb-2888249fc9eb38b6d6e4bd969ce63c26e3753d5e.tar.gz gdb-2888249fc9eb38b6d6e4bd969ce63c26e3753d5e.tar.bz2 |
ld: Create a new LOAD segment for separate code segment
When generating separate code LOAD segment, create a new LOAD segment
if the previous section contains text and the current section doesn't
or vice versa:
Elf file type is DYN (Shared object file)
Entry point 0x200020
There are 7 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x00000000 0x00000000 0x00200 0x00200 R 0x200000
LOAD 0x200000 0x00200000 0x00200000 0x00036 0x00036 R E 0x200000
LOAD 0x400000 0x00400000 0x00400000 0x00064 0x00064 R 0x200000
LOAD 0x400f80 0x00600f80 0x00600f80 0x000a0 0x000a0 RW 0x200000
DYNAMIC 0x400f80 0x00600f80 0x00600f80 0x00080 0x00080 RW 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10
GNU_RELRO 0x400f80 0x00600f80 0x00600f80 0x00080 0x00080 R 0x1
Section to Segment mapping:
Segment Sections...
00 .hash .gnu.hash .dynsym .dynstr .rela.plt
01 .plt .text
02 .rodata .eh_frame
03 .dynamic .got.plt
04 .dynamic
05
06 .dynamic
to prevent fetching or executing data in code pages as instructions.
Also don't put a writable section in a read-only segment if there is a
RELRO segment.
Since code segment is aligned and padded to the maximum page size on
disk, the minimum file size is bigger than the maximum page size which
is 2MB (0x200000):
-rwxr-xr-x 1 hjl hjl 4201932 Jan 10 10:41 libfoo.so
"-z max-page-size=0x1000" can be used to reduce the maximum page size to
4KB (0x1000):
-rwxr-xr-x 1 hjl hjl 15820 Jan 10 10:44 libfoo.so
PR ld/22393
* elf.c (_bfd_elf_map_sections_to_segments): When generating
separate code and read-only data LOAD segments, create a new
LOAD segment if the previous section contains text and the
current section doesn't or vice versa. Don't put a writable
section in a read-only segment if there is a RELRO segment.
Diffstat (limited to 'bfd/ChangeLog')
-rw-r--r-- | bfd/ChangeLog | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5ceb5a0..fa82d46 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,14 @@ 2018-01-11 H.J. Lu <hongjiu.lu@intel.com> + PR ld/22393 + * elf.c (_bfd_elf_map_sections_to_segments): When generating + separate code and read-only data LOAD segments, create a new + LOAD segment if the previous section contains text and the + current section doesn't or vice versa. Don't put a writable + section in a read-only segment if there is a RELRO segment. + +2018-01-11 H.J. Lu <hongjiu.lu@intel.com> + PR ld/22649 * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Ignore dynamic references on forced local symbols. |