diff options
author | Alan Modra <amodra@gmail.com> | 2022-02-08 10:40:35 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-02-13 14:00:56 +1030 |
commit | 2085ee26500b2d1b7a11ece8c44395e6403493f4 (patch) | |
tree | c1034f73b7ebc6fddcf1affa2fd2de83006f2771 /ld/ldlang.c | |
parent | 7d6aa4b321f2722512be7422394629eec526448b (diff) | |
download | gdb-2085ee26500b2d1b7a11ece8c44395e6403493f4.zip gdb-2085ee26500b2d1b7a11ece8c44395e6403493f4.tar.gz gdb-2085ee26500b2d1b7a11ece8c44395e6403493f4.tar.bz2 |
Don't pass around expld.dataseg pointer
The better to see any code that accesses expld.dataseg.
* ldexp.c (fold_segment_end): Remove seg parameter. Adjust calls.
(fold_segment_align, fold_segment_relro_end): Likewise.
* ldlang.c (lang_size_segment): Likewise.
(lang_size_relro_segment_1, lang_find_relro_sections_1): Likewise.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index f481586..474784c 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -5665,9 +5665,10 @@ os_region_check (lang_output_section_statement_type *os, } static void -ldlang_check_relro_region (lang_statement_union_type *s, - seg_align_type *seg) +ldlang_check_relro_region (lang_statement_union_type *s) { + seg_align_type *seg = &expld.dataseg; + if (seg->relro == exp_seg_relro_start) { if (!seg->relro_start_stat) @@ -6166,7 +6167,7 @@ lang_size_sections_1 output_section_statement->bfd_section, &newdot); - ldlang_check_relro_region (s, &expld.dataseg); + ldlang_check_relro_region (s); expld.dataseg.relro = exp_seg_relro_none; @@ -6346,10 +6347,11 @@ one_lang_size_sections_pass (bool *relax, bool check_regions) } static bool -lang_size_segment (seg_align_type *seg) +lang_size_segment (void) { /* If XXX_SEGMENT_ALIGN XXX_SEGMENT_END pair was seen, check whether a page could be saved in the data segment. */ + seg_align_type *seg = &expld.dataseg; bfd_vma first, last; first = -seg->base & (seg->commonpagesize - 1); @@ -6368,8 +6370,9 @@ lang_size_segment (seg_align_type *seg) } static bfd_vma -lang_size_relro_segment_1 (seg_align_type *seg) +lang_size_relro_segment_1 (void) { + seg_align_type *seg = &expld.dataseg; bfd_vma relro_end, desired_end; asection *sec; @@ -6415,7 +6418,7 @@ lang_size_relro_segment (bool *relax, bool check_regions) if (link_info.relro && expld.dataseg.relro_end) { bfd_vma data_initial_base = expld.dataseg.base; - bfd_vma data_relro_end = lang_size_relro_segment_1 (&expld.dataseg); + bfd_vma data_relro_end = lang_size_relro_segment_1 (); lang_reset_memory_regions (); one_lang_size_sections_pass (relax, check_regions); @@ -6424,11 +6427,11 @@ lang_size_relro_segment (bool *relax, bool check_regions) script have increased padding over the original. Revert. */ if (expld.dataseg.relro_end > data_relro_end) { - expld.dataseg.base = data_initial_base;; + expld.dataseg.base = data_initial_base; do_reset = true; } } - else if (lang_size_segment (&expld.dataseg)) + else if (lang_size_segment ()) do_reset = true; return do_reset; @@ -7679,7 +7682,6 @@ find_relro_section_callback (lang_wild_statement_type *ptr ATTRIBUTE_UNUSED, static void lang_find_relro_sections_1 (lang_statement_union_type *s, - seg_align_type *seg, bool *has_relro_section) { if (*has_relro_section) @@ -7687,7 +7689,7 @@ lang_find_relro_sections_1 (lang_statement_union_type *s, for (; s != NULL; s = s->header.next) { - if (s == seg->relro_end_stat) + if (s == expld.dataseg.relro_end_stat) break; switch (s->header.type) @@ -7699,15 +7701,15 @@ lang_find_relro_sections_1 (lang_statement_union_type *s, break; case lang_constructors_statement_enum: lang_find_relro_sections_1 (constructor_list.head, - seg, has_relro_section); + has_relro_section); break; case lang_output_section_statement_enum: lang_find_relro_sections_1 (s->output_section_statement.children.head, - seg, has_relro_section); + has_relro_section); break; case lang_group_statement_enum: lang_find_relro_sections_1 (s->group_statement.children.head, - seg, has_relro_section); + has_relro_section); break; default: break; @@ -7723,7 +7725,7 @@ lang_find_relro_sections (void) /* Check all sections in the link script. */ lang_find_relro_sections_1 (expld.dataseg.relro_start_stat, - &expld.dataseg, &has_relro_section); + &has_relro_section); if (!has_relro_section) link_info.relro = false; |