From d6cf28795dd28a7c5d34a58a015b7b04a932bdc7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 20 Jul 2000 03:21:59 +0000 Subject: [PATCH] 2000-07-19 H.J. Lu * elf32-arm.h (elf32_arm_size_dynamic_sections): Also set DF_TEXTREL if DT_TEXTREL is set. * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise. * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise. * elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise. * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise. * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise. * elf64-ia64.c (elf64_ia64_size_dynamic_sections): Likewise. * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise. * bfd/elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also set DF_SYMBOLIC for symbolic link. Also set DT_RUNPATH if DT_RPATH is set. Set the DT_FLAGS and DT_FLAGS_1 entries if necessary. --- bfd/ChangeLog | 20 ++++++++++++++++++++ bfd/elf32-arm.h | 1 + bfd/elf32-i370.c | 1 + bfd/elf32-i386.c | 1 + bfd/elf32-m68k.c | 1 + bfd/elf32-mips.c | 1 + bfd/elf32-ppc.c | 1 + bfd/elf32-sparc.c | 1 + bfd/elf64-alpha.c | 1 + bfd/elf64-hppa.c | 1 + bfd/elf64-ia64.c | 1 + bfd/elf64-sparc.c | 1 + bfd/elflink.h | 20 +++++++++++++++++++- 13 files changed, 50 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 210d6ad7476..0e2a4c7e363 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,23 @@ +2000-07-19 H.J. Lu + + * elf32-arm.h (elf32_arm_size_dynamic_sections): Also set + DF_TEXTREL if DT_TEXTREL is set. + * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise. + * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise. + * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise. + * elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise. + * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. + * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise. + * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise. + * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise. + * elf64-ia64.c (elf64_ia64_size_dynamic_sections): Likewise. + * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise. + + * bfd/elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also + set DF_SYMBOLIC for symbolic link. Also set DT_RUNPATH if + DT_RPATH is set. + Set the DT_FLAGS and DT_FLAGS_1 entries if necessary. + 2000-07-19 H.J. Lu * bfd-in.h (bfd_elf_set_dt_needed_soname): New. diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 828a58320bb..6b748ef638a 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -2991,6 +2991,7 @@ elf32_arm_size_dynamic_sections (output_bfd, info) { if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 0715d86d081..67c6964cd9f 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -959,6 +959,7 @@ i370_elf_size_dynamic_sections (output_bfd, info) { if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 997ae5434fe..ace82876df9 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1238,6 +1238,7 @@ elf_i386_size_dynamic_sections (output_bfd, info) { if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index b01523477b4..bee73b5a57d 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1307,6 +1307,7 @@ elf_m68k_size_dynamic_sections (output_bfd, info) { if (!bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 1e9e99bca1f..27ae18abb98 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -8319,6 +8319,7 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) { if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0)) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 6dc3effc3f1..3c7999b760c 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2044,6 +2044,7 @@ ppc_elf_size_dynamic_sections (output_bfd, info) { if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 70d65a5f87b..002938479db 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -1056,6 +1056,7 @@ elf32_sparc_size_dynamic_sections (output_bfd, info) { if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 84f3075e4c8..b4025c0228f 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -3312,6 +3312,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info) { if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index b90b47878f0..b5edaf14578 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -1789,6 +1789,7 @@ elf64_hppa_size_dynamic_sections (output_bfd, info) { if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf64-ia64.c b/bfd/elf64-ia64.c index cacfd6593fc..a8bebf219f2 100644 --- a/bfd/elf64-ia64.c +++ b/bfd/elf64-ia64.c @@ -2517,6 +2517,7 @@ elf64_ia64_size_dynamic_sections (output_bfd, info) { if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } } diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index ca2e7c1d2f4..b2b8cbf9ec0 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1803,6 +1803,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info) { if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; + info->flags |= DF_TEXTREL; } /* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER diff --git a/bfd/elflink.h b/bfd/elflink.h index 7fa35a936ce..1bf366873a8 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -2837,6 +2837,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, { if (! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0)) return false; + info->flags |= DF_SYMBOLIC; } if (rpath != NULL) @@ -2846,7 +2847,8 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, rpath, true, true); if (indx == (bfd_size_type) -1 - || ! elf_add_dynamic_entry (info, DT_RPATH, indx)) + || ! elf_add_dynamic_entry (info, DT_RPATH, indx) + || ! elf_add_dynamic_entry (info, DT_RUNPATH, indx)) return false; } @@ -3135,6 +3137,22 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, elf_tdata (output_bfd)->cverdefs = cdefs; } + if (info->flags) + { + if (! elf_add_dynamic_entry (info, DT_FLAGS, info->flags)) + return false; + } + + if (info->flags_1) + { + if (! info->shared) + info->flags_1 &= ~ (DF_1_INITFIRST + | DF_1_NODELETE + | DF_1_NOOPEN); + if (! elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1)) + return false; + } + /* Work out the size of the version reference section. */ s = bfd_get_section_by_name (dynobj, ".gnu.version_r"); -- 2.30.2