summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog42
-rw-r--r--bfd/elf32-arm.c2
-rw-r--r--bfd/elf32-bfin.c2
-rw-r--r--bfd/elf32-cr16.c2
-rw-r--r--bfd/elf32-cris.c2
-rw-r--r--bfd/elf32-frv.c2
-rw-r--r--bfd/elf32-hppa.c2
-rw-r--r--bfd/elf32-i370.c2
-rw-r--r--bfd/elf32-i386.c2
-rw-r--r--bfd/elf32-lm32.c2
-rw-r--r--bfd/elf32-m32r.c2
-rw-r--r--bfd/elf32-m68k.c2
-rw-r--r--bfd/elf32-metag.c2
-rw-r--r--bfd/elf32-nds32.c2
-rw-r--r--bfd/elf32-nios2.c2
-rw-r--r--bfd/elf32-or1k.c2
-rw-r--r--bfd/elf32-ppc.c2
-rw-r--r--bfd/elf32-s390.c2
-rw-r--r--bfd/elf32-score.c2
-rw-r--r--bfd/elf32-score7.c2
-rw-r--r--bfd/elf32-sh.c2
-rw-r--r--bfd/elf32-tic6x.c2
-rw-r--r--bfd/elf32-tilepro.c2
-rw-r--r--bfd/elf32-vax.c2
-rw-r--r--bfd/elf32-xtensa.c2
-rw-r--r--bfd/elf64-alpha.c2
-rw-r--r--bfd/elf64-hppa.c2
-rw-r--r--bfd/elf64-ppc.c2
-rw-r--r--bfd/elf64-s390.c2
-rw-r--r--bfd/elf64-sh64.c2
-rw-r--r--bfd/elf64-x86-64.c2
-rw-r--r--bfd/elflink.c4
-rw-r--r--bfd/elfnn-aarch64.c2
-rw-r--r--bfd/elfnn-ia64.c2
-rw-r--r--bfd/elfxx-mips.c2
-rw-r--r--bfd/elfxx-sparc.c2
-rw-r--r--bfd/elfxx-tilegx.c2
-rw-r--r--include/ChangeLog4
-rw-r--r--include/bfdlink.h3
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ld.texinfo7
-rw-r--r--ld/ldlex.h1
-rw-r--r--ld/lexsup.c7
43 files changed, 107 insertions, 37 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 70d99523e58..37ba69fa3aa 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,45 @@
+2015-09-20 Rich Felker <dalias@libc.org>
+
+ * 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.
+
2015-09-18 Doug Evans <xdje42@gmail.com>
* targets.c (enum bfd_flavour): Add comment.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index b65ae3995fa..bd41fd0ec91 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -13786,7 +13786,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 152134ee7b9..0d4d9cf6630 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -4255,7 +4255,7 @@ elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd,
if (htab->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index 5d8ffbcaa60..497630e987f 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -2464,7 +2464,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
#if 0
s = bfd_get_linker_section (dynobj, ".interp");
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 303117393fc..5b405247073 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -3764,7 +3764,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index fa12528b3d1..1dd2e8cac56 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -5442,7 +5442,7 @@ elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 8f0f4d0f089..ad40914c484 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -2215,7 +2215,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->etab.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
sec = bfd_get_linker_section (dynobj, ".interp");
if (sec == NULL)
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index 7fba4d1f417..458f69495d0 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -594,7 +594,7 @@ i370_elf_size_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 85885f71e17..93904503e4f 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2876,7 +2876,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index 23f6e5ea756..0805e3c9a5f 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -2141,7 +2141,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
if (htab->root.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 155d07904f3..a2e3c7ce64c 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -2170,7 +2170,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->root.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index f807e03741a..03940fde24f 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -3257,7 +3257,7 @@ elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
index 0fcafc4d9c3..596cf761a71 100644
--- a/bfd/elf32-metag.c
+++ b/bfd/elf32-metag.c
@@ -2848,7 +2848,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->etab.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index e59110053a7..28d4df8b933 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -3980,7 +3980,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->root.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (!bfd_link_pic (info))
+ if (!bfd_link_pic (info) && !info->nointerp)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index 91897265c83..6b29d8b97f1 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -5849,7 +5849,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index d4f92b78fdf..a1eba0956e4 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2447,7 +2447,7 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->root.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 3f708cb1713..708076d65e8 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -6191,7 +6191,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (htab->elf.dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 96c1531e7df..2143ee1773d 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -2039,7 +2039,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index a976a1539f6..ce9c3777559 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -3269,7 +3269,7 @@ s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (!bfd_link_pic (info))
+ if (!bfd_link_pic (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index 1af034eac07..b0e75bb9cae 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -3078,7 +3078,7 @@ s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (!bfd_link_pic (info))
+ if (!bfd_link_pic (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index fdeadd016d5..9fa363615dd 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -3349,7 +3349,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->root.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index b6640eabc88..380ab8dd2bf 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -3300,7 +3300,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
index cb3f896281d..d55be2d3cee 100644
--- a/bfd/elf32-tilepro.c
+++ b/bfd/elf32-tilepro.c
@@ -2463,7 +2463,7 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 6089e8c8f33..893ea8d5fb4 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -1124,7 +1124,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index ada3e5a3cee..c2aef2578eb 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -1641,7 +1641,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
&& htab->sgotloc != NULL);
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 35c1ec61891..e46f27fdc54 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -2890,7 +2890,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 6f40b88481e..3b628b466f5 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -1558,7 +1558,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
sec = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (sec != NULL);
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 5ad5f48c0e2..e5344df446b 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -9815,7 +9815,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 0264236f2a5..1c3769976e6 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -1989,7 +1989,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index e4608953dff..d920598008f 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -3404,7 +3404,7 @@ sh64_elf64_size_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 2230c15bc1d..cbb8cfb3484 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3227,7 +3227,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 4e52d7bf090..aec96e5d617 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)
{
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index c9780fcf11f..24ef79f5686 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -7982,7 +7982,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->root.dynamic_sections_created)
{
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index c45fa2818af..3b304d53c85 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -2992,7 +2992,7 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Set the contents of the .interp section to the interpreter. */
if (ia64_info->root.dynamic_sections_created
- && bfd_link_executable (info))
+ && bfd_link_executable (info) && !info->nointerp)
{
sec = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (sec != NULL);
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 5ece52d0122..4689b214633 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -9579,7 +9579,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 9bb71a99335..db0d4f18046 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2559,7 +2559,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c
index 59a2f7ef288..6f7485a0272 100644
--- a/bfd/elfxx-tilegx.c
+++ b/bfd/elfxx-tilegx.c
@@ -2724,7 +2724,7 @@ tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (bfd_link_executable (info))
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
diff --git a/include/ChangeLog b/include/ChangeLog
index 4fedda7ad0f..8b9f921f292 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-20 Rich Felker <dalias@libc.org>
+
+ * bfdlink.h (struct bfd_link_info): Add "nointerp" field.
+
2015-08-23 Alan Modra <amodra@gmail.com>
* bfdlink.h (enum output_type): Reorder enum.
diff --git a/include/bfdlink.h b/include/bfdlink.h
index 43bcc6a9040..2ffb3d1ab56 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -431,6 +431,9 @@ struct bfd_link_info
/* TRUE if BND prefix in PLT entries is always generated. */
unsigned int bndplt: 1;
+ /* TRUE if generation of .interp/PT_INTERP should be suppressed. */
+ unsigned int nointerp: 1;
+
/* Char that may appear as the first char of a symbol, but should be
skipped (like symbol_leading_char) when looking up symbols in
wrap_hash. Used by PowerPC Linux for 'dot' symbols. */
diff --git a/ld/ChangeLog b/ld/ChangeLog
index e73abeb023a..e1e06b83dc6 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-20 Rich Felker <dalias@libc.org>
+
+ * 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.
+
2015-09-18 Alan Modra <amodra@gmail.com>
* ld.texinfo: Document PowerPC64 --{no-,}save-restore-funcs.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index c5d39d5e2c1..6b7fac82fd2 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -1455,6 +1455,13 @@ generating dynamically linked ELF executables. The default dynamic
linker is normally correct; don't use this unless you know what you are
doing.
+@kindex --no-dynamic-linker
+@item --no-dynamic-linker
+When producing an executable file, omit the request for a dynamic
+linker to be used at load-time. This is only meaningful for ELF
+executables that contain dynamic relocations, and usually requires
+entry point code that is capable of processing these relocations.
+
@kindex --fatal-warnings
@kindex --no-fatal-warnings
@item --fatal-warnings
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 5629ef19f18..6f11e7bd217 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -33,6 +33,7 @@ enum option_values
OPTION_DEFSYM,
OPTION_DEMANGLE,
OPTION_DYNAMIC_LINKER,
+ OPTION_NO_DYNAMIC_LINKER,
OPTION_SYSROOT,
OPTION_EB,
OPTION_EL,
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 5dc56dc148e..fdd39a73dc2 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -138,6 +138,9 @@ static const struct ld_option ld_options[] =
{ {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
'I', N_("PROGRAM"), N_("Set PROGRAM as the dynamic linker to use"),
TWO_DASHES },
+ { {"no-dynamic-linker", no_argument, NULL, OPTION_NO_DYNAMIC_LINKER},
+ '\0', NULL, N_("Produce an executable with no program interpreter header"),
+ TWO_DASHES },
{ {"library", required_argument, NULL, 'l'},
'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES },
{ {"library-path", required_argument, NULL, 'L'},
@@ -761,6 +764,10 @@ parse_args (unsigned argc, char **argv)
case 'I': /* Used on Solaris. */
case OPTION_DYNAMIC_LINKER:
command_line.interpreter = optarg;
+ link_info.nointerp = 0;
+ break;
+ case OPTION_NO_DYNAMIC_LINKER:
+ link_info.nointerp = 1;
break;
case OPTION_SYSROOT:
/* Already handled in ldmain.c. */