diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-11-12 17:17:47 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-11-12 17:17:58 -0800 |
commit | 0f99513f2a52b7d73b94a1f77b8c6de9159b50d7 (patch) | |
tree | 09f4858b812d81f4d02b85855b9e18794649001c /ld/ldlang.c | |
parent | f882209d9aa5b68d68c45c5849e129ffc228749c (diff) | |
download | gdb-0f99513f2a52b7d73b94a1f77b8c6de9159b50d7.zip gdb-0f99513f2a52b7d73b94a1f77b8c6de9159b50d7.tar.gz gdb-0f99513f2a52b7d73b94a1f77b8c6de9159b50d7.tar.bz2 |
ld: Update phase_enum/relro_enum and add seg_align_type
Update GNU_RELRO date type so that they can also be used for text-only
LOAD segment.
* ldexp.h (phase_enum): Rename exp_dataseg_none,
exp_dataseg_align_seen, exp_dataseg_relro_seen,
exp_dataseg_end_seen, exp_dataseg_relro_adjust,
exp_dataseg_adjust and exp_dataseg_done to exp_seg_none,
exp_seg_align_seen, exp_seg_relro_seen, exp_seg_end_seen,
exp_seg_relro_adjust, exp_seg_adjust and exp_seg_done.
(relro_enum): Rename exp_dataseg_relro_none,
exp_dataseg_relro_start and exp_dataseg_relro_end to
exp_seg_relro_none, exp_seg_relro_start and exp_seg_relro_end.
(seg_align_type): New struct type.
(ldexp_control): Use seg_align_type.
* ldexp.c (fold_unary): Updated.
(fold_binary): Likewise.
* ldlang.c (strip_excluded_output_sections): Likewise.
(lang_size_sections_1): Likewise.
(lang_size_sections): Likewise.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index b89c4e6..2cb1647 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3890,7 +3890,7 @@ strip_excluded_output_sections (void) if (expld.phase != lang_mark_phase_enum) { expld.phase = lang_mark_phase_enum; - expld.dataseg.phase = exp_dataseg_none; + expld.dataseg.phase = exp_seg_none; one_lang_size_sections_pass (NULL, FALSE); lang_reset_memory_regions (); } @@ -5426,13 +5426,13 @@ lang_size_sections_1 bfd_vma newdot = dot; etree_type *tree = s->assignment_statement.exp; - expld.dataseg.relro = exp_dataseg_relro_none; + expld.dataseg.relro = exp_seg_relro_none; exp_fold_tree (tree, output_section_statement->bfd_section, &newdot); - if (expld.dataseg.relro == exp_dataseg_relro_start) + if (expld.dataseg.relro == exp_seg_relro_start) { if (!expld.dataseg.relro_start_stat) expld.dataseg.relro_start_stat = s; @@ -5441,7 +5441,7 @@ lang_size_sections_1 ASSERT (expld.dataseg.relro_start_stat == s); } } - else if (expld.dataseg.relro == exp_dataseg_relro_end) + else if (expld.dataseg.relro == exp_seg_relro_end) { if (!expld.dataseg.relro_end_stat) expld.dataseg.relro_end_stat = s; @@ -5450,7 +5450,7 @@ lang_size_sections_1 ASSERT (expld.dataseg.relro_end_stat == s); } } - expld.dataseg.relro = exp_dataseg_relro_none; + expld.dataseg.relro = exp_seg_relro_none; /* This symbol may be relative to this section. */ if ((tree->type.node_class == etree_provided @@ -5593,10 +5593,10 @@ void lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions) { expld.phase = lang_allocating_phase_enum; - expld.dataseg.phase = exp_dataseg_none; + expld.dataseg.phase = exp_seg_none; one_lang_size_sections_pass (relax, check_regions); - if (expld.dataseg.phase == exp_dataseg_end_seen + if (expld.dataseg.phase == exp_seg_end_seen && link_info.relro && expld.dataseg.relro_end) { bfd_vma initial_base, relro_end, desired_end; @@ -5631,7 +5631,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions) desired_end = start; } - expld.dataseg.phase = exp_dataseg_relro_adjust; + expld.dataseg.phase = exp_seg_relro_adjust; ASSERT (desired_end >= expld.dataseg.base); initial_base = expld.dataseg.base; expld.dataseg.base = desired_end; @@ -5651,7 +5651,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions) link_info.relro_start = expld.dataseg.base; link_info.relro_end = expld.dataseg.relro_end; } - else if (expld.dataseg.phase == exp_dataseg_end_seen) + else if (expld.dataseg.phase == exp_seg_end_seen) { /* If DATA_SEGMENT_ALIGN DATA_SEGMENT_END pair was seen, check whether a page could be saved in the data segment. */ @@ -5664,15 +5664,15 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions) != (expld.dataseg.end & ~(expld.dataseg.pagesize - 1))) && first + last <= expld.dataseg.pagesize) { - expld.dataseg.phase = exp_dataseg_adjust; + expld.dataseg.phase = exp_seg_adjust; lang_reset_memory_regions (); one_lang_size_sections_pass (relax, check_regions); } else - expld.dataseg.phase = exp_dataseg_done; + expld.dataseg.phase = exp_seg_done; } else - expld.dataseg.phase = exp_dataseg_done; + expld.dataseg.phase = exp_seg_done; } static lang_output_section_statement_type *current_section; |