diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-11-10 13:53:20 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-01-09 09:14:32 -0800 |
commit | c91ad020c2d0c10cb41ecd1516baa0321ce0c895 (patch) | |
tree | abd733e940018b0d1456f8224fbcdb4a61fe62cf /readline/display.c | |
parent | 972d6cb518582722cb6162dd76b0486673dcdd55 (diff) | |
download | gdb-c91ad020c2d0c10cb41ecd1516baa0321ce0c895.zip gdb-c91ad020c2d0c10cb41ecd1516baa0321ce0c895.tar.gz gdb-c91ad020c2d0c10cb41ecd1516baa0321ce0c895.tar.bz2 |
ld: Add TEXT_SEGMENT_ALIGN/TEXT_SEGMENT_{RELRO_}END
Text-only LOAD segment has the same requirement for segment alignment
and page sizes as GNU_RELRO segment. But for GNU_RELRO segment, the
segment may not end at the same address of the end of data segment. But
text-only LOAD segment is exactly the same as text LOAD segment.
This patch adds TEXT_SEGMENT_ALIGN, TEXT_SEGMENT_RELRO_END and
TEXT_SEGMENT_END, which mimic DATA_SEGMENT_ALIGN, DATA_SEGMENT_RELRO_END
and DATA_SEGMENT_END. They work on text segment, instead of data
segment. TEXT_SEGMENT_ALIGN is placed at the start of text sections.
Both TEXT_SEGMENT_RELRO_END and TEXT_SEGMENT_END are placed at the end
of text sections. TEXT_SEGMENT_ALIGN is created from DATA_SEGMENT_ALIGN
by replacing DATA_SEGMENT_ALIGN with TEXT_SEGMENT_ALIGN. It simply sets
text_start and text_end from TEXT_SEGMENT_ALIGN, TEXT_SEGMENT_RELRO_END
and TEXT_SEGMENT_END the same way as relro_start and relro_end are set
from DATA_SEGMENT_ALIGN, DATA_SEGMENT_RELRO_END and DATA_SEGMENT_END.
include/
PR ld/22393
* bfdlink.h (bfd_link_info): Add text_start and text_end.
ld/
PR ld/22393
* ldexp.c (exp_print_token): Add TEXT_SEGMENT_ALIGN,
TEXT_SEGMENT_RELRO_END and TEXT_SEGMENT_END.
(fold_unary): Handle TEXT_SEGMENT_END.
(fold_binary): Handle TEXT_SEGMENT_RELRO_END and
TEXT_SEGMENT_END.
(exp_unop): Also check TEXT_SEGMENT_END.
* ldexp.h (ldexp_control): Add textseg.
* ldgram.y: Handle TEXT_SEGMENT_ALIGN, TEXT_SEGMENT_RELRO_END
and TEXT_SEGMENT_END.
* ldlang.c (strip_excluded_output_sections): Also set
expld.textseg.phase to exp_seg_none.
(lang_size_sections_1): Also call ldlang_check_relro_region with
&expld.textseg.
(lang_size_relro_segment): Also handle expld.textseg.
(lang_size_sections): Also handle expld.textseg. Set
link_info.text_start and link_info.text_end for -z textonly.
(lang_find_relro_sections): Also check expld.textseg.
* ldlex.l: Add TEXT_SEGMENT_ALIGN, TEXT_SEGMENT_RELRO_END and
TEXT_SEGMENT_END.
* scripttempl/elf.sc (TEXT_SEGMENT_ALIGN): New.
(TEXT_SEGMENT_RELRO_END): Likewise.
(TEXT_SEGMENT_END): Likewise.
Add ${TEXT_SEGMENT_ALIGN} before text sections and add
${TEXT_SEGMENT_RELRO_END}/${TEXT_SEGMENT_END} after text
sections for non-relocatable link.
Diffstat (limited to 'readline/display.c')
0 files changed, 0 insertions, 0 deletions