elflink.c: Replace bed->dynamic_sec_flags with flags

Message ID 20250203040128.2447215-1-hjl.tools@gmail.com
State New
Headers
Series elflink.c: Replace bed->dynamic_sec_flags with flags |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

H.J. Lu Feb. 3, 2025, 4:01 a.m. UTC
  Since at the function entry, there is

  flags = bed->dynamic_sec_flags;

we can replace bed->dynamic_sec_flags with flags.

	* elflink.c (_bfd_elf_create_got_section): Replace
	bed->dynamic_sec_flags with flags.
	(_bfd_elf_link_create_dynamic_sections): Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 bfd/elflink.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

Alan Modra Feb. 4, 2025, 4:58 a.m. UTC | #1
On Mon, Feb 03, 2025 at 12:01:28PM +0800, H.J. Lu wrote:
> 	* elflink.c (_bfd_elf_create_got_section): Replace
> 	bed->dynamic_sec_flags with flags.
> 	(_bfd_elf_link_create_dynamic_sections): Likewise.

OK.
  

Patch

diff --git a/bfd/elflink.c b/bfd/elflink.c
index 309b4d75094..a31e4092a16 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -198,8 +198,7 @@  _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
   s = bfd_make_section_anyway_with_flags (abfd,
 					  (bed->rela_plts_and_copies_p
 					   ? ".rela.got" : ".rel.got"),
-					  (bed->dynamic_sec_flags
-					   | SEC_READONLY));
+					  flags | SEC_READONLY);
   if (s == NULL
       || !bfd_set_section_alignment (s, bed->s->log_file_align))
     return false;
@@ -397,8 +396,7 @@  _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
   if (info->enable_dt_relr)
     {
       s = bfd_make_section_anyway_with_flags (abfd, ".relr.dyn",
-					      (bed->dynamic_sec_flags
-					       | SEC_READONLY));
+					      flags | SEC_READONLY);
       if (s == NULL
 	  || !bfd_set_section_alignment (s, bed->s->log_file_align))
 	return false;