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/ldexp.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/ldexp.c')
-rw-r--r-- | ld/ldexp.c | 44 |
1 files changed, 22 insertions, 22 deletions
@@ -394,15 +394,15 @@ fold_unary (etree_type *tree) { expld.result.valid_p = FALSE; } - else if (expld.dataseg.phase == exp_dataseg_align_seen - || expld.dataseg.phase == exp_dataseg_relro_seen) + else if (expld.dataseg.phase == exp_seg_align_seen + || expld.dataseg.phase == exp_seg_relro_seen) { - expld.dataseg.phase = exp_dataseg_end_seen; + expld.dataseg.phase = exp_seg_end_seen; expld.dataseg.end = expld.result.value; } - else if (expld.dataseg.phase == exp_dataseg_done - || expld.dataseg.phase == exp_dataseg_adjust - || expld.dataseg.phase == exp_dataseg_relro_adjust) + else if (expld.dataseg.phase == exp_seg_done + || expld.dataseg.phase == exp_seg_adjust + || expld.dataseg.phase == exp_seg_relro_adjust) { /* OK. */ } @@ -573,7 +573,7 @@ fold_binary (etree_type *tree) break; case DATA_SEGMENT_ALIGN: - expld.dataseg.relro = exp_dataseg_relro_start; + expld.dataseg.relro = exp_seg_relro_start; if (expld.phase == lang_first_phase_enum || expld.section != bfd_abs_section_ptr) expld.result.valid_p = FALSE; @@ -583,9 +583,9 @@ fold_binary (etree_type *tree) bfd_vma commonpage = expld.result.value; expld.result.value = align_n (expld.dot, maxpage); - if (expld.dataseg.phase == exp_dataseg_relro_adjust) + if (expld.dataseg.phase == exp_seg_relro_adjust) expld.result.value = expld.dataseg.base; - else if (expld.dataseg.phase == exp_dataseg_adjust) + else if (expld.dataseg.phase == exp_seg_adjust) { if (commonpage < maxpage) expld.result.value += ((expld.dot + commonpage - 1) @@ -594,13 +594,13 @@ fold_binary (etree_type *tree) else { expld.result.value += expld.dot & (maxpage - 1); - if (expld.dataseg.phase == exp_dataseg_done) + if (expld.dataseg.phase == exp_seg_done) { /* OK. */ } - else if (expld.dataseg.phase == exp_dataseg_none) + else if (expld.dataseg.phase == exp_seg_none) { - expld.dataseg.phase = exp_dataseg_align_seen; + expld.dataseg.phase = exp_seg_align_seen; expld.dataseg.base = expld.result.value; expld.dataseg.pagesize = commonpage; expld.dataseg.maxpagesize = maxpage; @@ -615,21 +615,21 @@ fold_binary (etree_type *tree) case DATA_SEGMENT_RELRO_END: /* Operands swapped! DATA_SEGMENT_RELRO_END(offset,exp) has offset in expld.result and exp in lhs. */ - expld.dataseg.relro = exp_dataseg_relro_end; + expld.dataseg.relro = exp_seg_relro_end; expld.dataseg.relro_offset = expld.result.value; if (expld.phase == lang_first_phase_enum || expld.section != bfd_abs_section_ptr) expld.result.valid_p = FALSE; - else if (expld.dataseg.phase == exp_dataseg_align_seen - || expld.dataseg.phase == exp_dataseg_adjust - || expld.dataseg.phase == exp_dataseg_relro_adjust - || expld.dataseg.phase == exp_dataseg_done) + else if (expld.dataseg.phase == exp_seg_align_seen + || expld.dataseg.phase == exp_seg_adjust + || expld.dataseg.phase == exp_seg_relro_adjust + || expld.dataseg.phase == exp_seg_done) { - if (expld.dataseg.phase == exp_dataseg_align_seen - || expld.dataseg.phase == exp_dataseg_relro_adjust) + if (expld.dataseg.phase == exp_seg_align_seen + || expld.dataseg.phase == exp_seg_relro_adjust) expld.dataseg.relro_end = lhs.value + expld.result.value; - if (expld.dataseg.phase == exp_dataseg_relro_adjust + if (expld.dataseg.phase == exp_seg_relro_adjust && (expld.dataseg.relro_end & (expld.dataseg.pagesize - 1))) { @@ -641,8 +641,8 @@ fold_binary (etree_type *tree) else expld.result.value = lhs.value; - if (expld.dataseg.phase == exp_dataseg_align_seen) - expld.dataseg.phase = exp_dataseg_relro_seen; + if (expld.dataseg.phase == exp_seg_align_seen) + expld.dataseg.phase = exp_seg_relro_seen; } else expld.result.valid_p = FALSE; |