0001-staticpie.diff 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
  2. index bd4b576..41803c2 100644
  3. --- a/bfd/elf32-arm.c
  4. +++ b/bfd/elf32-arm.c
  5. @@ -13786,7 +13786,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
  6. if (elf_hash_table (info)->dynamic_sections_created)
  7. {
  8. /* Set the contents of the .interp section to the interpreter. */
  9. - if (info->executable)
  10. + if (info->executable && !info->nointerp)
  11. {
  12. s = bfd_get_linker_section (dynobj, ".interp");
  13. BFD_ASSERT (s != NULL);
  14. diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
  15. index 49ef360..8346d57 100644
  16. --- a/bfd/elf32-bfin.c
  17. +++ b/bfd/elf32-bfin.c
  18. @@ -4257,7 +4257,7 @@ elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd,
  19. if (htab->dynamic_sections_created)
  20. {
  21. /* Set the contents of the .interp section to the interpreter. */
  22. - if (info->executable)
  23. + if (info->executable && !info->nointerp)
  24. {
  25. s = bfd_get_linker_section (dynobj, ".interp");
  26. BFD_ASSERT (s != NULL);
  27. diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
  28. index 5d8ffbc..497630e 100644
  29. --- a/bfd/elf32-cr16.c
  30. +++ b/bfd/elf32-cr16.c
  31. @@ -2464,7 +2464,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
  32. if (elf_hash_table (info)->dynamic_sections_created)
  33. {
  34. /* Set the contents of the .interp section to the interpreter. */
  35. - if (info->executable)
  36. + if (info->executable && !info->nointerp)
  37. {
  38. #if 0
  39. s = bfd_get_linker_section (dynobj, ".interp");
  40. diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
  41. index 3031173..5b40524 100644
  42. --- a/bfd/elf32-cris.c
  43. +++ b/bfd/elf32-cris.c
  44. @@ -3764,7 +3764,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  45. if (elf_hash_table (info)->dynamic_sections_created)
  46. {
  47. /* Set the contents of the .interp section to the interpreter. */
  48. - if (info->executable)
  49. + if (info->executable && !info->nointerp)
  50. {
  51. s = bfd_get_linker_section (dynobj, ".interp");
  52. BFD_ASSERT (s != NULL);
  53. diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
  54. index b55a7ab..ef72c23 100644
  55. --- a/bfd/elf32-frv.c
  56. +++ b/bfd/elf32-frv.c
  57. @@ -5444,7 +5444,7 @@ elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd,
  58. if (elf_hash_table (info)->dynamic_sections_created)
  59. {
  60. /* Set the contents of the .interp section to the interpreter. */
  61. - if (info->executable)
  62. + if (info->executable && !info->nointerp)
  63. {
  64. s = bfd_get_linker_section (dynobj, ".interp");
  65. BFD_ASSERT (s != NULL);
  66. diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
  67. index 41bf5c5..62c7cf6 100644
  68. --- a/bfd/elf32-hppa.c
  69. +++ b/bfd/elf32-hppa.c
  70. @@ -2215,7 +2215,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  71. if (htab->etab.dynamic_sections_created)
  72. {
  73. /* Set the contents of the .interp section to the interpreter. */
  74. - if (info->executable)
  75. + if (info->executable && !info->nointerp)
  76. {
  77. sec = bfd_get_linker_section (dynobj, ".interp");
  78. if (sec == NULL)
  79. diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
  80. index 7fba4d1..458f694 100644
  81. --- a/bfd/elf32-i370.c
  82. +++ b/bfd/elf32-i370.c
  83. @@ -594,7 +594,7 @@ i370_elf_size_dynamic_sections (bfd *output_bfd,
  84. if (elf_hash_table (info)->dynamic_sections_created)
  85. {
  86. /* Set the contents of the .interp section to the interpreter. */
  87. - if (info->executable)
  88. + if (info->executable && !info->nointerp)
  89. {
  90. s = bfd_get_linker_section (dynobj, ".interp");
  91. BFD_ASSERT (s != NULL);
  92. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
  93. index 7642d0f..b0844c8 100644
  94. --- a/bfd/elf32-i386.c
  95. +++ b/bfd/elf32-i386.c
  96. @@ -2834,7 +2834,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
  97. if (htab->elf.dynamic_sections_created)
  98. {
  99. /* Set the contents of the .interp section to the interpreter. */
  100. - if (info->executable)
  101. + if (info->executable && !info->nointerp)
  102. {
  103. s = bfd_get_linker_section (dynobj, ".interp");
  104. if (s == NULL)
  105. diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
  106. index 23f6e5e..0805e3c 100644
  107. --- a/bfd/elf32-lm32.c
  108. +++ b/bfd/elf32-lm32.c
  109. @@ -2141,7 +2141,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
  110. if (htab->root.dynamic_sections_created)
  111. {
  112. /* Set the contents of the .interp section to the interpreter. */
  113. - if (info->executable)
  114. + if (info->executable && !info->nointerp)
  115. {
  116. s = bfd_get_linker_section (dynobj, ".interp");
  117. BFD_ASSERT (s != NULL);
  118. diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
  119. index 155d079..a2e3c7c 100644
  120. --- a/bfd/elf32-m32r.c
  121. +++ b/bfd/elf32-m32r.c
  122. @@ -2170,7 +2170,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  123. if (htab->root.dynamic_sections_created)
  124. {
  125. /* Set the contents of the .interp section to the interpreter. */
  126. - if (info->executable)
  127. + if (info->executable && !info->nointerp)
  128. {
  129. s = bfd_get_linker_section (dynobj, ".interp");
  130. BFD_ASSERT (s != NULL);
  131. diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
  132. index 10d2fcb..489f3f1 100644
  133. --- a/bfd/elf32-m68k.c
  134. +++ b/bfd/elf32-m68k.c
  135. @@ -3257,7 +3257,7 @@ elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  136. if (elf_hash_table (info)->dynamic_sections_created)
  137. {
  138. /* Set the contents of the .interp section to the interpreter. */
  139. - if (info->executable)
  140. + if (info->executable && !info->nointerp)
  141. {
  142. s = bfd_get_linker_section (dynobj, ".interp");
  143. BFD_ASSERT (s != NULL);
  144. diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
  145. index 9c54a71..755c431 100644
  146. --- a/bfd/elf32-metag.c
  147. +++ b/bfd/elf32-metag.c
  148. @@ -2848,7 +2848,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  149. if (htab->etab.dynamic_sections_created)
  150. {
  151. /* Set the contents of the .interp section to the interpreter. */
  152. - if (info->executable)
  153. + if (info->executable && !info->nointerp)
  154. {
  155. s = bfd_get_linker_section (dynobj, ".interp");
  156. if (s == NULL)
  157. diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
  158. index fd70007..2a2b3a6 100644
  159. --- a/bfd/elf32-nios2.c
  160. +++ b/bfd/elf32-nios2.c
  161. @@ -5849,7 +5849,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  162. if (elf_hash_table (info)->dynamic_sections_created)
  163. {
  164. /* Set the contents of the .interp section to the interpreter. */
  165. - if (info->executable)
  166. + if (info->executable && !info->nointerp)
  167. {
  168. s = bfd_get_linker_section (dynobj, ".interp");
  169. BFD_ASSERT (s != NULL);
  170. diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
  171. index d4f92b7..a1eba09 100644
  172. --- a/bfd/elf32-or1k.c
  173. +++ b/bfd/elf32-or1k.c
  174. @@ -2447,7 +2447,7 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  175. if (htab->root.dynamic_sections_created)
  176. {
  177. /* Set the contents of the .interp section to the interpreter. */
  178. - if (info->executable)
  179. + if (info->executable && !info->nointerp)
  180. {
  181. s = bfd_get_section_by_name (dynobj, ".interp");
  182. BFD_ASSERT (s != NULL);
  183. diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
  184. index 8415f1e..5597051 100644
  185. --- a/bfd/elf32-ppc.c
  186. +++ b/bfd/elf32-ppc.c
  187. @@ -6191,7 +6191,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
  188. if (elf_hash_table (info)->dynamic_sections_created)
  189. {
  190. /* Set the contents of the .interp section to the interpreter. */
  191. - if (info->executable)
  192. + if (info->executable && !info->nointerp)
  193. {
  194. s = bfd_get_linker_section (htab->elf.dynobj, ".interp");
  195. BFD_ASSERT (s != NULL);
  196. diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
  197. index de37ca4..a1e628c 100644
  198. --- a/bfd/elf32-s390.c
  199. +++ b/bfd/elf32-s390.c
  200. @@ -2039,7 +2039,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  201. if (htab->elf.dynamic_sections_created)
  202. {
  203. /* Set the contents of the .interp section to the interpreter. */
  204. - if (info->executable)
  205. + if (info->executable && !info->nointerp)
  206. {
  207. s = bfd_get_linker_section (dynobj, ".interp");
  208. if (s == NULL)
  209. diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
  210. index 012ee4e..a51453f 100644
  211. --- a/bfd/elf32-sh.c
  212. +++ b/bfd/elf32-sh.c
  213. @@ -3349,7 +3349,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  214. if (htab->root.dynamic_sections_created)
  215. {
  216. /* Set the contents of the .interp section to the interpreter. */
  217. - if (info->executable)
  218. + if (info->executable && !info->nointerp)
  219. {
  220. s = bfd_get_linker_section (dynobj, ".interp");
  221. BFD_ASSERT (s != NULL);
  222. diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
  223. index b6640ea..380ab8d 100644
  224. --- a/bfd/elf32-tic6x.c
  225. +++ b/bfd/elf32-tic6x.c
  226. @@ -3300,7 +3300,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
  227. if (htab->elf.dynamic_sections_created)
  228. {
  229. /* Set the contents of the .interp section to the interpreter. */
  230. - if (info->executable)
  231. + if (info->executable && !info->nointerp)
  232. {
  233. s = bfd_get_linker_section (dynobj, ".interp");
  234. if (s == NULL)
  235. diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
  236. index cb3f896..d55be2d 100644
  237. --- a/bfd/elf32-tilepro.c
  238. +++ b/bfd/elf32-tilepro.c
  239. @@ -2463,7 +2463,7 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
  240. if (elf_hash_table (info)->dynamic_sections_created)
  241. {
  242. /* Set the contents of the .interp section to the interpreter. */
  243. - if (info->executable)
  244. + if (info->executable && !info->nointerp)
  245. {
  246. s = bfd_get_linker_section (dynobj, ".interp");
  247. BFD_ASSERT (s != NULL);
  248. diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
  249. index 6089e8c..893ea8d 100644
  250. --- a/bfd/elf32-vax.c
  251. +++ b/bfd/elf32-vax.c
  252. @@ -1124,7 +1124,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
  253. if (elf_hash_table (info)->dynamic_sections_created)
  254. {
  255. /* Set the contents of the .interp section to the interpreter. */
  256. - if (info->executable)
  257. + if (info->executable && !info->nointerp)
  258. {
  259. s = bfd_get_linker_section (dynobj, ".interp");
  260. BFD_ASSERT (s != NULL);
  261. diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
  262. index 73538cd..37ea5da 100644
  263. --- a/bfd/elf32-xtensa.c
  264. +++ b/bfd/elf32-xtensa.c
  265. @@ -1637,7 +1637,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  266. && htab->sgotloc != NULL);
  267. /* Set the contents of the .interp section to the interpreter. */
  268. - if (info->executable)
  269. + if (info->executable && !info->nointerp)
  270. {
  271. s = bfd_get_linker_section (dynobj, ".interp");
  272. if (s == NULL)
  273. diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
  274. index f67b0af..1973cd0 100644
  275. --- a/bfd/elf64-alpha.c
  276. +++ b/bfd/elf64-alpha.c
  277. @@ -2877,7 +2877,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  278. if (elf_hash_table (info)->dynamic_sections_created)
  279. {
  280. /* Set the contents of the .interp section to the interpreter. */
  281. - if (info->executable)
  282. + if (info->executable && !info->nointerp)
  283. {
  284. s = bfd_get_linker_section (dynobj, ".interp");
  285. BFD_ASSERT (s != NULL);
  286. diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
  287. index 6f40b88..3b628b4 100644
  288. --- a/bfd/elf64-hppa.c
  289. +++ b/bfd/elf64-hppa.c
  290. @@ -1558,7 +1558,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
  291. if (elf_hash_table (info)->dynamic_sections_created)
  292. {
  293. /* Set the contents of the .interp section to the interpreter. */
  294. - if (info->executable)
  295. + if (info->executable && !info->nointerp)
  296. {
  297. sec = bfd_get_linker_section (dynobj, ".interp");
  298. BFD_ASSERT (sec != NULL);
  299. diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
  300. index 8cff990..851845f 100644
  301. --- a/bfd/elf64-ppc.c
  302. +++ b/bfd/elf64-ppc.c
  303. @@ -9748,7 +9748,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
  304. if (htab->elf.dynamic_sections_created)
  305. {
  306. /* Set the contents of the .interp section to the interpreter. */
  307. - if (info->executable)
  308. + if (info->executable && !info->nointerp)
  309. {
  310. s = bfd_get_linker_section (dynobj, ".interp");
  311. if (s == NULL)
  312. diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
  313. index 2e505f3..406bb66 100644
  314. --- a/bfd/elf64-s390.c
  315. +++ b/bfd/elf64-s390.c
  316. @@ -1989,7 +1989,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  317. if (htab->elf.dynamic_sections_created)
  318. {
  319. /* Set the contents of the .interp section to the interpreter. */
  320. - if (info->executable)
  321. + if (info->executable && !info->nointerp)
  322. {
  323. s = bfd_get_linker_section (dynobj, ".interp");
  324. if (s == NULL)
  325. diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
  326. index e460895..d920598 100644
  327. --- a/bfd/elf64-sh64.c
  328. +++ b/bfd/elf64-sh64.c
  329. @@ -3404,7 +3404,7 @@ sh64_elf64_size_dynamic_sections (bfd *output_bfd,
  330. if (elf_hash_table (info)->dynamic_sections_created)
  331. {
  332. /* Set the contents of the .interp section to the interpreter. */
  333. - if (info->executable)
  334. + if (info->executable && !info->nointerp)
  335. {
  336. s = bfd_get_linker_section (dynobj, ".interp");
  337. BFD_ASSERT (s != NULL);
  338. diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
  339. index f15d33e..870aadf 100644
  340. --- a/bfd/elf64-x86-64.c
  341. +++ b/bfd/elf64-x86-64.c
  342. @@ -3181,7 +3181,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
  343. if (htab->elf.dynamic_sections_created)
  344. {
  345. /* Set the contents of the .interp section to the interpreter. */
  346. - if (info->executable)
  347. + if (info->executable && !info->nointerp)
  348. {
  349. s = bfd_get_linker_section (dynobj, ".interp");
  350. if (s == NULL)
  351. diff --git a/bfd/elflink.c b/bfd/elflink.c
  352. index 7f04271..5b3438d 100644
  353. --- a/bfd/elflink.c
  354. +++ b/bfd/elflink.c
  355. @@ -246,7 +246,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
  356. /* A dynamically linked executable has a .interp section, but a
  357. shared library does not. */
  358. - if (info->executable)
  359. + if (info->executable && !info->nointerp)
  360. {
  361. s = bfd_make_section_anyway_with_flags (abfd, ".interp",
  362. flags | SEC_READONLY);
  363. @@ -5763,7 +5763,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
  364. bfd_boolean all_defined;
  365. *sinterpptr = bfd_get_linker_section (dynobj, ".interp");
  366. - BFD_ASSERT (*sinterpptr != NULL || !info->executable);
  367. + BFD_ASSERT (*sinterpptr != NULL || !info->executable || info->nointerp);
  368. if (soname != NULL)
  369. {
  370. diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
  371. index beedb70..599f9cf 100644
  372. --- a/bfd/elfnn-aarch64.c
  373. +++ b/bfd/elfnn-aarch64.c
  374. @@ -7674,7 +7674,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  375. if (htab->root.dynamic_sections_created)
  376. {
  377. - if (info->executable)
  378. + if (info->executable && !info->nointerp)
  379. {
  380. s = bfd_get_linker_section (dynobj, ".interp");
  381. if (s == NULL)
  382. diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
  383. index c45fa28..3b304d5 100644
  384. --- a/bfd/elfnn-ia64.c
  385. +++ b/bfd/elfnn-ia64.c
  386. @@ -2992,7 +2992,7 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  387. /* Set the contents of the .interp section to the interpreter. */
  388. if (ia64_info->root.dynamic_sections_created
  389. - && info->executable)
  390. + && info->executable && !info->nointerp)
  391. {
  392. sec = bfd_get_linker_section (dynobj, ".interp");
  393. BFD_ASSERT (sec != NULL);
  394. diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
  395. index be1e59a..329dec3 100644
  396. --- a/bfd/elfxx-mips.c
  397. +++ b/bfd/elfxx-mips.c
  398. @@ -9579,7 +9579,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
  399. if (elf_hash_table (info)->dynamic_sections_created)
  400. {
  401. /* Set the contents of the .interp section to the interpreter. */
  402. - if (info->executable)
  403. + if (info->executable && !info->nointerp)
  404. {
  405. s = bfd_get_linker_section (dynobj, ".interp");
  406. BFD_ASSERT (s != NULL);
  407. diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
  408. index 9bb71a9..db0d4f1 100644
  409. --- a/bfd/elfxx-sparc.c
  410. +++ b/bfd/elfxx-sparc.c
  411. @@ -2559,7 +2559,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
  412. if (elf_hash_table (info)->dynamic_sections_created)
  413. {
  414. /* Set the contents of the .interp section to the interpreter. */
  415. - if (info->executable)
  416. + if (info->executable && !info->nointerp)
  417. {
  418. s = bfd_get_linker_section (dynobj, ".interp");
  419. BFD_ASSERT (s != NULL);
  420. diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c
  421. index 59a2f7e..6f7485a 100644
  422. --- a/bfd/elfxx-tilegx.c
  423. +++ b/bfd/elfxx-tilegx.c
  424. @@ -2724,7 +2724,7 @@ tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
  425. if (elf_hash_table (info)->dynamic_sections_created)
  426. {
  427. /* Set the contents of the .interp section to the interpreter. */
  428. - if (info->executable)
  429. + if (info->executable && !info->nointerp)
  430. {
  431. s = bfd_get_linker_section (dynobj, ".interp");
  432. BFD_ASSERT (s != NULL);
  433. diff --git a/include/bfdlink.h b/include/bfdlink.h
  434. index 797a465..cf533dd 100644
  435. --- a/include/bfdlink.h
  436. +++ b/include/bfdlink.h
  437. @@ -433,6 +433,9 @@ struct bfd_link_info
  438. /* TRUE if BND prefix in PLT entries is always generated. */
  439. unsigned int bndplt: 1;
  440. + /* TRUE if generation of .interp/PT_INTERP should be suppressed. */
  441. + unsigned int nointerp: 1;
  442. +
  443. /* Char that may appear as the first char of a symbol, but should be
  444. skipped (like symbol_leading_char) when looking up symbols in
  445. wrap_hash. Used by PowerPC Linux for 'dot' symbols. */
  446. diff --git a/ld/ld.texinfo b/ld/ld.texinfo
  447. index cf3b586..1e5e5cf 100644
  448. --- a/ld/ld.texinfo
  449. +++ b/ld/ld.texinfo
  450. @@ -1426,6 +1426,13 @@ generating dynamically linked ELF executables. The default dynamic
  451. linker is normally correct; don't use this unless you know what you are
  452. doing.
  453. +@kindex --no-dynamic-linker
  454. +@item --no-dynamic-linker
  455. +When producing an executable file, omit the request for a dynamic
  456. +linker to be used at load-time. This is only meaningful for ELF
  457. +executables that contain dynamic relocations, and usually requires
  458. +entry point code that is capable of processing these relocations.
  459. +
  460. @kindex --fatal-warnings
  461. @kindex --no-fatal-warnings
  462. @item --fatal-warnings
  463. diff --git a/ld/ldlex.h b/ld/ldlex.h
  464. index 59bd14f..8b57f84 100644
  465. --- a/ld/ldlex.h
  466. +++ b/ld/ldlex.h
  467. @@ -33,6 +33,7 @@ enum option_values
  468. OPTION_DEFSYM,
  469. OPTION_DEMANGLE,
  470. OPTION_DYNAMIC_LINKER,
  471. + OPTION_NO_DYNAMIC_LINKER,
  472. OPTION_SYSROOT,
  473. OPTION_EB,
  474. OPTION_EL,
  475. diff --git a/ld/lexsup.c b/ld/lexsup.c
  476. index 777d6e2..1b992f7 100644
  477. --- a/ld/lexsup.c
  478. +++ b/ld/lexsup.c
  479. @@ -138,6 +138,9 @@ static const struct ld_option ld_options[] =
  480. { {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
  481. 'I', N_("PROGRAM"), N_("Set PROGRAM as the dynamic linker to use"),
  482. TWO_DASHES },
  483. + { {"no-dynamic-linker", no_argument, NULL, OPTION_NO_DYNAMIC_LINKER},
  484. + '\0', NULL, N_("Produce an executable with no program interpreter header"),
  485. + TWO_DASHES },
  486. { {"library", required_argument, NULL, 'l'},
  487. 'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES },
  488. { {"library-path", required_argument, NULL, 'L'},
  489. @@ -762,6 +765,10 @@ parse_args (unsigned argc, char **argv)
  490. case 'I': /* Used on Solaris. */
  491. case OPTION_DYNAMIC_LINKER:
  492. command_line.interpreter = optarg;
  493. + link_info.nointerp = 0;
  494. + break;
  495. + case OPTION_NO_DYNAMIC_LINKER:
  496. + link_info.nointerp = 1;
  497. break;
  498. case OPTION_SYSROOT:
  499. /* Already handled in ldmain.c. */