aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-02-08 10:40:35 +1030
committerAlan Modra <amodra@gmail.com>2022-02-13 14:00:56 +1030
commit2085ee26500b2d1b7a11ece8c44395e6403493f4 (patch)
treec1034f73b7ebc6fddcf1affa2fd2de83006f2771 /ld/ldexp.c
parent7d6aa4b321f2722512be7422394629eec526448b (diff)
downloadbinutils-2085ee26500b2d1b7a11ece8c44395e6403493f4.zip
binutils-2085ee26500b2d1b7a11ece8c44395e6403493f4.tar.gz
binutils-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/ldexp.c')
-rw-r--r--ld/ldexp.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index ab72407..90760e0 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -340,8 +340,10 @@ update_definedness (const char *name, struct bfd_link_hash_entry *h)
}
static void
-fold_segment_end (seg_align_type *seg)
+fold_segment_end (void)
{
+ seg_align_type *seg = &expld.dataseg;
+
if (expld.phase == lang_first_phase_enum
|| expld.section != bfd_abs_section_ptr)
{
@@ -410,7 +412,7 @@ fold_unary (etree_type *tree)
break;
case DATA_SEGMENT_END:
- fold_segment_end (&expld.dataseg);
+ fold_segment_end ();
break;
default:
@@ -447,8 +449,10 @@ arith_result_section (const etree_value_type *lhs)
}
static void
-fold_segment_align (seg_align_type *seg, etree_value_type *lhs)
+fold_segment_align (etree_value_type *lhs)
{
+ seg_align_type *seg = &expld.dataseg;
+
seg->relro = exp_seg_relro_start;
if (expld.phase == lang_first_phase_enum
|| expld.section != bfd_abs_section_ptr)
@@ -494,8 +498,10 @@ fold_segment_align (seg_align_type *seg, etree_value_type *lhs)
}
static void
-fold_segment_relro_end (seg_align_type *seg, etree_value_type *lhs)
+fold_segment_relro_end (etree_value_type *lhs)
{
+ seg_align_type *seg = &expld.dataseg;
+
/* Operands swapped! XXX_SEGMENT_RELRO_END(offset,exp) has offset
in expld.result and exp in lhs. */
seg->relro = exp_seg_relro_end;
@@ -662,11 +668,11 @@ fold_binary (etree_type *tree)
break;
case DATA_SEGMENT_ALIGN:
- fold_segment_align (&expld.dataseg, &lhs);
+ fold_segment_align (&lhs);
break;
case DATA_SEGMENT_RELRO_END:
- fold_segment_relro_end (&expld.dataseg, &lhs);
+ fold_segment_relro_end (&lhs);
break;
default: