From 25844aaec2671c9975e2cbad8637bec980d9ecee Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 20 Jul 2002 13:41:11 +0000 Subject: [PATCH] * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't bomb on /DISCARD/ input section. * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/mmo.em (mmo_place_orphan): Likewise. --- ld/ChangeLog | 7 +++++++ ld/emultempl/elf32.em | 2 +- ld/emultempl/mmo.em | 6 +++++- ld/emultempl/pe.em | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 1443cc62f0f..01ee8c576da 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2002-07-20 Alan Modra + + * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't + bomb on /DISCARD/ input section. + * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise. + * emultempl/mmo.em (mmo_place_orphan): Likewise. + 2002-07-19 Hans-Peter Nilsson * emultempl/mmo.em (mmo_place_orphan): Handle case of no .text diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 58a1ccc0bcb..26e4c46297f 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1249,7 +1249,7 @@ gld${EMULATION_NAME}_place_orphan (file, s) /* Restore the global list pointer. */ stat_ptr = old; - if (place != NULL) + if (place != NULL && os->bfd_section != NULL) { asection *snew, **pps; diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em index 23bab165376..8b17dcc2ac7 100644 --- a/ld/emultempl/mmo.em +++ b/ld/emultempl/mmo.em @@ -152,6 +152,11 @@ mmo_place_orphan (file, s) /* Restore the global list pointer. */ stat_ptr = old; + snew = os->bfd_section; + if (snew == NULL) + /* /DISCARD/ section. */ + return true; + /* We need an output section for .text as a root, so if there was none (might happen with a peculiar linker script such as in "map addresses", map-address.exp), we grab the output section created @@ -163,7 +168,6 @@ mmo_place_orphan (file, s) hold_text.os = os; } - snew = os->bfd_section; bfd_section = place->os->bfd_section; if (place->section == NULL && bfd_section == NULL) bfd_section = output_prev_sec_find (place->os); diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index a6dfe463737..37146ab59f8 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1668,7 +1668,7 @@ gld_${EMULATION_NAME}_place_orphan (file, s) stat_ptr = old; - if (place != NULL) + if (place != NULL && os->bfd_section != NULL) { asection *snew, **pps; -- 2.30.2