diff options
author | Rich Felker <dalias@libc.org> | 2015-09-20 12:20:19 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-09-20 15:52:27 +0930 |
commit | 9b8b325a1f4cdaf235e7d803849dde6ededec865 (patch) | |
tree | f9705d4b1b4e10dbb5a5453e944a31f798457088 /bfd/elflink.c | |
parent | 25f004c8dd2d96f92ea8f18217a04212f907eb94 (diff) | |
download | gdb-9b8b325a1f4cdaf235e7d803849dde6ededec865.zip gdb-9b8b325a1f4cdaf235e7d803849dde6ededec865.tar.gz gdb-9b8b325a1f4cdaf235e7d803849dde6ededec865.tar.bz2 |
Add --no-dynamic-linker option to ld, for static PIE use
Inhibits output of .interp section in ELF executables.
include/
* bfdlink.h (struct bfd_link_info): Add "nointerp" field.
bfd/
* elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create
.interp when info->nointerp.
(bfd_elf_size_dynamic_sections): Adjust assert.
* elf32-arm.c (elf32_arm_size_dynamic_sections): Don't size .interp
when info->nointerp.
* elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
* elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
* elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise.
* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
* elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
* elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
* elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
* elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
* elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
* elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
* elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
* elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
* elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Likewise.
* elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise.
* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
* elfnn-ia64.c (elfNN_ia64_size_dynamic_sections): Likewise.
* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
* elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
ld/
* ld.texinfo (--no-dynamic-linker): Document.
* ldlex.h (enum option_values): Add OPTION_NO_DYNAMIC_LINKER.
* lexsup.c (ld_options, parse_args): Handle --no-dynamic-linker.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 4e52d7b..aec96e5 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -246,7 +246,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) /* A dynamically linked executable has a .interp section, but a shared library does not. */ - if (bfd_link_executable (info)) + if (bfd_link_executable (info) && !info->nointerp) { s = bfd_make_section_anyway_with_flags (abfd, ".interp", flags | SEC_READONLY); @@ -5763,7 +5763,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, bfd_boolean all_defined; *sinterpptr = bfd_get_linker_section (dynobj, ".interp"); - BFD_ASSERT (*sinterpptr != NULL || !bfd_link_executable (info)); + BFD_ASSERT (*sinterpptr != NULL || !bfd_link_executable (info) || info->nointerp); if (soname != NULL) { |