]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
elf: Cache ".interp" section pointer in elf_link_hash_table
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 14 Sep 2025 21:40:16 +0000 (14:40 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 18 Sep 2025 11:31:23 +0000 (04:31 -0700)
Cache ".interp" section pointer in elf_link_hash_table so that a backend
can use it to avoid calling bfd_get_linker_section.

* elf-bfd.h (elf_link_hash_table): Add interp.
* elf-m10300.c (_bfd_mn10300_elf_late_size_sections): Use the
interp field in elf_link_hash_table.
* elf32-arc.c (elf_arc_late_size_sections): Likewise.
* elf32-arm.c (elf32_arm_late_size_sections): Likewise.
* elf32-bfin.c (elf32_bfinfdpic_late_size_sections): Likewise.
(bfin_late_size_sections): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_late_size_sections): Likewise.
* elf32-cris.c (elf_cris_late_size_sections): Likewise.
* elf32-csky.c (csky_elf_late_size_sections): Likewise.
* elf32-frv.c (elf32_frvfdpic_late_size_sections): Likewise.
* elf32-hppa.c (elf32_hppa_late_size_sections): Likewise.
* elf32-lm32.c (lm32_elf_late_size_sections): Likewise.
* elf32-m32r.c (m32r_elf_late_size_sections): Likewise.
* elf32-m68k.c (elf_m68k_late_size_sections): Likewise.
* elf32-metag.c (elf_metag_late_size_sections): Likewise.
* elf32-nds32.c (nds32_elf_late_size_sections): Likewise.
* elf32-or1k.c (or1k_elf_late_size_sections): Likewise.
* elf32-ppc.c (ppc_elf_late_size_sections): Likewise.
* elf32-s390.c (elf_s390_late_size_sections): Likewise.
* elf32-score.c (s3_bfd_score_elf_late_size_sections): Likewise.
* elf32-score7.c (s7_bfd_score_elf_late_size_sections): Likewise.
* elf32-sh.c (sh_elf_late_size_sections): Likewise.
* elf32-tic6x.c (elf32_tic6x_late_size_sections): Likewise.
* elf32-tilepro.c (tilepro_elf_late_size_sections): Likewise.
* elf32-vax.c (elf_vax_late_size_sections): Likewise.
* elf32-xtensa.c (elf_xtensa_late_size_sections): Likewise.
* elf64-alpha.c (elf64_alpha_late_size_sections): Likewise.
* elf64-hppa.c (elf64_hppa_late_size_sections): Likewise.
* elf64-ppc.c (ppc64_elf_late_size_sections): Likewise.
* elf64-s390.c (elf_s390_late_size_sections): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_late_size_sections): Likewise.
* elfnn-ia64.c (elfNN_ia64_late_size_sections): Likewise.
* elfnn-kvx.c (elfNN_kvx_late_size_sections): Likewise.
* elfnn-loongarch.c (loongarch_elf_late_size_sections): Likewise.
* elfnn-riscv.c (riscv_elf_late_size_sections): Likewise.
* elfxx-mips.c (_bfd_mips_elf_late_size_sections): Likewise.
* elfxx-tilegx.c (tilegx_elf_late_size_sections): Likewise.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Cache the
pointer to ".interp" section in the interp field in
elf_link_hash_table.
(bfd_elf_size_dynamic_sections): Use the interp field in
elf_link_hash_table.
* elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Use the
interp field in elf_link_hash_table.
(_bfd_sparc_elf_late_size_sections): Likewise.  Don't set
interp.
* elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove interp.
* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Check
htab->elf.interp instead of htab->interp.
(_bfd_x86_elf_link_setup_gnu_properties): Use htab->elf.interp.
* elfxx-x86.h (elf_x86_link_hash_table): Remove interp.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
41 files changed:
bfd/elf-bfd.h
bfd/elf-m10300.c
bfd/elf32-arc.c
bfd/elf32-arm.c
bfd/elf32-bfin.c
bfd/elf32-cr16.c
bfd/elf32-cris.c
bfd/elf32-csky.c
bfd/elf32-frv.c
bfd/elf32-hppa.c
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-m68k.c
bfd/elf32-metag.c
bfd/elf32-nds32.c
bfd/elf32-or1k.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-score.c
bfd/elf32-score7.c
bfd/elf32-sh.c
bfd/elf32-tic6x.c
bfd/elf32-tilepro.c
bfd/elf32-vax.c
bfd/elf32-xtensa.c
bfd/elf64-alpha.c
bfd/elf64-hppa.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elflink.c
bfd/elfnn-aarch64.c
bfd/elfnn-ia64.c
bfd/elfnn-kvx.c
bfd/elfnn-loongarch.c
bfd/elfnn-riscv.c
bfd/elfxx-mips.c
bfd/elfxx-sparc.c
bfd/elfxx-sparc.h
bfd/elfxx-tilegx.c
bfd/elfxx-x86.c
bfd/elfxx-x86.h

index de7cc410a990610baf9e2a47ee80b4f2aead7b47..51e6ae7bb78df85cab6ec7e800e69ce0356d87bd 100644 (file)
@@ -774,6 +774,7 @@ struct elf_link_hash_table
   asection *dynsym;
   asection *srelrdyn;
   asection *dynamic;
+  asection *interp;
 };
 
 /* Returns TRUE if the hash table is a struct elf_link_hash_table.  */
index ba993869e2835d615869ae7913864395a9c6da0f..b381bb9037cf44d43e29f729b0f872b7b6b4ee65 100644 (file)
@@ -5031,7 +5031,7 @@ _bfd_mn10300_elf_late_size_sections (bfd * output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index a78516dc12f6d280ff33bea4c10f76dd1ae3e166..ebfe4dcc26a01d10dc1640a60c8b386ea8055e9d 100644 (file)
@@ -2743,7 +2743,7 @@ elf_arc_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
         interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_section_by_name (dynobj, ".interp");
+         s = htab->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof (ELF_DYNAMIC_INTERPRETER);
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index df60430b7c3049fc6d184b72c53c6f22b01c4949..ae3dc246be0ee8c51fb42958d846eb5e4feb136a 100644 (file)
@@ -16693,7 +16693,7 @@ elf32_arm_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 249c6b52af0df6b599e7c5ff5be4c29768936c30..7ed1285f4c2bace4c5ea400822082567d6acd6b7 100644 (file)
@@ -4050,7 +4050,7 @@ elf32_bfinfdpic_late_size_sections (bfd *output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
@@ -5142,7 +5142,7 @@ bfin_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index fc2e2d48f270abfcfc63acf70b9ea257347b6bbe..31d1ba41c1710a5b9037400d218f40ed3110702e 100644 (file)
@@ -2408,7 +2408,7 @@ _bfd_cr16_elf_late_size_sections (bfd * output_bfd,
       if (bfd_link_executable (info) && !info->nointerp)
        {
 #if 0
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 285c6c794a2260bd0d6539ed39a676808faae2cd..faaebb9ebee952355641eaf3ab62ff321bc956f2 100644 (file)
@@ -3527,7 +3527,7 @@ elf_cris_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->root.interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 2a08659f06f58e832d11e4b29ebfa45f05120f92..40781a0e1bbc8625b5b0e727f537ea3efa8e3cff 100644 (file)
@@ -1912,7 +1912,7 @@ csky_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (!bfd_link_pic (info) && !info->nointerp)
        {
-         s = bfd_get_section_by_name (dynobj, ".interp");
+         s = htab->elf.interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 0423540cf98839245086dfe13e0651a5421289ca..b7183133ad1a9ec670c00a37818582de88c90b5d 100644 (file)
@@ -5444,7 +5444,7 @@ elf32_frvfdpic_late_size_sections (bfd *output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
index 80b89fac38b743500a2e3a583d7143bef1181a78..2f463e12829aa7b6e0bee60ee246fe2f0045d95b 100644 (file)
@@ -2063,7 +2063,7 @@ elf32_hppa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         sec = bfd_get_linker_section (dynobj, ".interp");
+         sec = htab->etab.interp;
          if (sec == NULL)
            abort ();
          sec->size = sizeof ELF_DYNAMIC_INTERPRETER;
index b36e92d150a481fe0c70479e9c719087e031d96f..0ead0df9cf0b7fbc1da2c85f1210763dcb803b21 100644 (file)
@@ -1926,7 +1926,7 @@ lm32_elf_late_size_sections (bfd *output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->root.interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 49cc5fc42407ea4daceb95263b75a1c47b387589..c51133090b4a6d23bdd4aef5c533201cdf991e83 100644 (file)
@@ -1983,7 +1983,7 @@ m32r_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 84ad64ac0ec2207e67161edb42be496fa91219ef..44ef102ea601bde46efc543a6db47235a33e9a14 100644 (file)
@@ -3122,7 +3122,7 @@ elf_m68k_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 0e6cfd885fee5af0b378818dc717c6d8f501c0ad..916f3e15c7200995043010e494c8a8675e8399c9 100644 (file)
@@ -2698,7 +2698,7 @@ elf_metag_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->etab.interp;
          if (s == NULL)
            abort ();
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
index bcd7c42e300ed47a7048e2b71b790f0b7eaa6024..e22b58c4ea8bdcb9b6a6861fd78be32cdbb166b9 100644 (file)
@@ -4326,7 +4326,7 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_section_by_name (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index b17a872f12392a90d4a2f76c8e73f4db3d166a92..159308fec7446989d88a47a551b845fc19e97b9e 100644 (file)
@@ -3066,7 +3066,7 @@ or1k_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_section_by_name (dynobj, ".interp");
+         s = htab->root.interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 1ed995bfb0098b303d74fe42a5021aba3c97fdef..a3adcf8430e8e9a2e1733257c6db00ae6ee63941 100644 (file)
@@ -5485,7 +5485,7 @@ ppc_elf_late_size_sections (bfd *output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (htab->elf.dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 40fcb53ff3a7c256ace93a02427542456a65c4a5..56c613dd7d7f2ef67f2474351141170ce4d3a874 100644 (file)
@@ -1793,7 +1793,7 @@ elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->elf.interp;
          if (s == NULL)
            abort ();
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
index 57bf04d93665a914f6036acd5d37c181661a8e02..d91f2dedcf55f419d112736e104f758e7b3f5957 100644 (file)
@@ -3243,7 +3243,7 @@ s3_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
          s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
index cbbff13933e19d9833a82bcea2434f8978678b46..44718f39ccfda4b90082f0f103f5fd8c2e735b81 100644 (file)
@@ -3053,7 +3053,7 @@ s7_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
          s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
index d3f3a5675896f5038ccb208d324c68ce525cb2c4..e078e41b675af964d02362aa0a80c03b978ffdfc 100644 (file)
@@ -2962,7 +2962,7 @@ sh_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->root.interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index cc204c2ca084ace83c0ee7b16989fbab72e18c20..a31c381531e4a1f09651e3cf75cff183613517bb 100644 (file)
@@ -3171,7 +3171,7 @@ elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info)
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->elf.interp;
          if (s == NULL)
            abort ();
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
index 3e3a068ac7bde8d6a03a1c22a4134209c4903b2f..12ff2a9121fbb5ac6863493bd0596837c02c205f 100644 (file)
@@ -2199,7 +2199,7 @@ tilepro_elf_late_size_sections (bfd *output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF32_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF32_DYNAMIC_INTERPRETER;
index 4cb69ad3117a0ba22237e7c8fdf51f6ef20e8c7e..a5ced1f69583bab362568e076dc87d8a7a98d97a 100644 (file)
@@ -1037,7 +1037,7 @@ elf_vax_late_size_sections (bfd *output_bfd, struct bfd_link_info *info)
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 6f8a4fa7c213bff9b4c3335d6a10a4d377712c26..b21676df36a0b98c9dd9136dc33d379b7e28047a 100644 (file)
@@ -1588,7 +1588,7 @@ elf_xtensa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          if (s == NULL)
            abort ();
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
index 55aebca0ee820d1500dc07ac55cd1a7df93eb528..b13c99e4958c6f65bf15a6feba0d639250b537b6 100644 (file)
@@ -2809,7 +2809,7 @@ elf64_alpha_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 7b80603fdafd648fef39f766e2cf10b6a45cf888..57de68c9b07524e14edf5ecfd21452ffe58dfe39 100644 (file)
@@ -1555,7 +1555,7 @@ elf64_hppa_late_size_sections (bfd *output_bfd, struct bfd_link_info *info)
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         sec = bfd_get_linker_section (dynobj, ".interp");
+         sec = hppa_info->root.interp;
          BFD_ASSERT (sec != NULL);
          sec->size = sizeof ELF_DYNAMIC_INTERPRETER;
          sec->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
index 2cacc9e27a2156a7a8a063f165ff79098daba360..fdda9e0bbb3cdcec0d0dacecd9bb55d7086cd665 100644 (file)
@@ -10250,7 +10250,7 @@ ppc64_elf_late_size_sections (bfd *output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->elf.interp;
          if (s == NULL)
            abort ();
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
index 6ae62a91112dab5c281ea15feb5416ff8adc19c9..555395ca5ad557827b6715e36763696d378e5b47 100644 (file)
@@ -1946,7 +1946,7 @@ elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->elf.interp;
          if (s == NULL)
            abort ();
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
index 53ec792852cc9823786d804dec5fcc9a53acee43..b04b017747fb35d1c1b997964913f78b927ca457 100644 (file)
@@ -354,6 +354,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
                                              flags | SEC_READONLY);
       if (s == NULL)
        return false;
+      elf_hash_table (info)->interp = s;
     }
 
   /* Create sections to hold version informations.  These are removed
@@ -7547,7 +7548,7 @@ NOTE: This behaviour is deprecated and will be removed in a future version of th
       asection *dynstr;
       asection *s;
 
-      *sinterpptr = bfd_get_linker_section (dynobj, ".interp");
+      *sinterpptr = elf_hash_table (info)->interp;
       BFD_ASSERT (*sinterpptr != NULL || !bfd_link_executable (info) || info->nointerp);
 
       if (info->symbolic)
index 4517567a554a7c4eb3743e8dec926db9f5ea0049..3c3c28996748db1455d7686040e6ff26f9ad77bb 100644 (file)
@@ -9486,7 +9486,7 @@ elfNN_aarch64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
     {
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->root.interp;
          if (s == NULL)
            abort ();
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
index 685a37f407280eb5e5b43d9f4a3d22f30f74e9bd..528b1dcdcc3a67a409f9e0b79c115c8a477b5efb 100644 (file)
@@ -3007,7 +3007,7 @@ elfNN_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
   if (ia64_info->root.dynamic_sections_created
       && bfd_link_executable (info) && !info->nointerp)
     {
-      sec = bfd_get_linker_section (dynobj, ".interp");
+      sec = ia64_info->root.interp;
       BFD_ASSERT (sec != NULL);
       sec->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
       sec->alloced = 1;
index 0634ad389d5f916776d807ecc2b16285b5be277a..3b44db5742147a150b7bb442aad8ae56a03f7109 100644 (file)
@@ -4046,7 +4046,7 @@ elfNN_kvx_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
     {
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->root.interp;
          if (s == NULL)
            abort ();
          s->size = sizeof ELF_DYNAMIC_INTERPRETER;
index 8beb3d8407957c3b697d363346dc218f057988a4..c7b3711de86bf7ba9863871889a19baa72fd3a23 100644 (file)
@@ -2384,7 +2384,7 @@ loongarch_elf_late_size_sections (bfd *output_bfd,
       if (bfd_link_executable (info) && !info->nointerp)
        {
          const char *interpreter;
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->elf.interp;
          BFD_ASSERT (s != NULL);
 
          if (elf_elfheader (output_bfd)->e_ident[EI_CLASS] == ELFCLASS32)
index aac061fb43d15fe308e85945fb5426cc3fd9799e..09cf7076733ab875c4ce5e1643d4ee3efde7f48e 100644 (file)
@@ -1711,7 +1711,7 @@ riscv_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info)
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = strlen (ELFNN_DYNAMIC_INTERPRETER) + 1;
          s->contents = (unsigned char *) ELFNN_DYNAMIC_INTERPRETER;
index a171af59bf8b941b68e02b4ae03653c72ef8b4cc..bf3fd7df805eb3271b780f506ce4b9d2247a3e0f 100644 (file)
@@ -10075,7 +10075,7 @@ _bfd_mips_elf_late_size_sections (bfd *output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->root.interp;
          BFD_ASSERT (s != NULL);
          s->size
            = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1;
index f0b379555afe17c84bac1fc967d9528947d79d53..bbaa78291323c84240c76f30f90a2d1bf14e6832 100644 (file)
@@ -679,7 +679,7 @@ _bfd_sparc_elf_info_to_howto (bfd *abfd, arelent *cache_ptr,
 #define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, EH)              \
   ((EH)->elf.root.type == bfd_link_hash_undefweak              \
    && bfd_link_executable (INFO)                               \
-   && (_bfd_sparc_elf_hash_table (INFO)->interp == NULL                \
+   && (_bfd_sparc_elf_hash_table (INFO)->elf.interp == NULL    \
        || !(INFO)->dynamic_undefined_weak                      \
        || (EH)->has_non_got_reloc                              \
        || !(EH)->has_got_reloc))
@@ -2408,12 +2408,11 @@ _bfd_sparc_elf_late_size_sections (bfd *output_bfd,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = elf_hash_table (info)->interp;
          BFD_ASSERT (s != NULL);
          s->size = htab->dynamic_interpreter_size;
          s->contents = (unsigned char *) htab->dynamic_interpreter;
          s->alloced = 1;
-         htab->interp = s;
        }
     }
 
index 633b10e55e9f55296579ebf34f716f862b18d90f..572c2331112ca0dbf8884d3ab464b121a4e82057 100644 (file)
@@ -46,9 +46,6 @@ struct _bfd_sparc_elf_link_hash_table
 {
   struct elf_link_hash_table elf;
 
-  /* Short-cut to get to dynamic linker sections.  */
-  asection *interp;
-
   union
   {
     bfd_signed_vma refcount;
index 1854e693931e0b5c46c65ca3d932d253ded70896..79358e6b204973974dfff0e03d7606ff71be5bfe 100644 (file)
@@ -2448,7 +2448,7 @@ tilegx_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       /* Set the contents of the .interp section to the interpreter.  */
       if (bfd_link_executable (info) && !info->nointerp)
        {
-         s = bfd_get_linker_section (dynobj, ".interp");
+         s = htab->elf.interp;
          BFD_ASSERT (s != NULL);
          s->size = strlen (htab->dynamic_interpreter) + 1;
          s->contents = (unsigned char *) htab->dynamic_interpreter;
index 06265ee4e15560366717d731aa987723d8816cea..0d389968c9167fa1c92a51c473452b1657628fd6 100644 (file)
@@ -3665,7 +3665,7 @@ _bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info,
       || (h->root.type == bfd_link_hash_undefweak
          && (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
              || (bfd_link_executable (info)
-                 && htab->interp == NULL)
+                 && htab->elf.interp == NULL)
              || info->dynamic_undefined_weak == 0))
       || ((h->def_regular || ELF_COMMON_DEF_P (h))
          && info->version_info != NULL
@@ -4702,15 +4702,12 @@ _bfd_x86_elf_link_setup_gnu_properties
     {
       /* Whe creating executable, set the contents of the .interp
         section to the interpreter.  */
-      if (bfd_link_executable (info) && !info->nointerp)
+      asection *s = htab->elf.interp;
+      if (s != NULL)
        {
-         asection *s = bfd_get_linker_section (dynobj, ".interp");
-         if (s == NULL)
-           abort ();
          s->size = htab->dynamic_interpreter_size;
          s->contents = (unsigned char *) htab->dynamic_interpreter;
          s->alloced = 1;
-         htab->interp = s;
        }
 
       if (normal_target)
index 5593203f9ec02f201c8c01585c3907b88054a3cd..1ebc9d2f2e5c7846155282f91733a5c50a4993c9 100644 (file)
@@ -602,7 +602,6 @@ struct elf_x86_link_hash_table
   struct elf_link_hash_table elf;
 
   /* Short-cuts to get to dynamic linker sections.  */
-  asection *interp;
   asection *plt_eh_frame;
   asection *plt_second;
   asection *plt_second_eh_frame;