[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug with GNU ld
From: |
Alan Modra |
Subject: |
Re: Bug with GNU ld |
Date: |
Sat, 20 Jul 2002 23:10:10 +0930 |
User-agent: |
Mutt/1.3.25i |
On Sat, Jul 20, 2002 at 08:09:53AM -0400, Pete Gonzalez wrote:
> If you add this line to a C or C++ program:
>
> __attribute__((section("/DISCARD/"))) int x;
>
> and compile with GCC, it causes a linker core dump.
It even segfaults on current CVS. This should fix it.
ld/ChangeLog
* 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.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.79
diff -u -p -r1.79 elf32.em
--- ld/emultempl/elf32.em 17 Jun 2002 14:08:38 -0000 1.79
+++ ld/emultempl/elf32.em 20 Jul 2002 13:35:42 -0000
@@ -1249,7 +1249,7 @@ gld${EMULATION_NAME}_place_orphan (file,
/* Restore the global list pointer. */
stat_ptr = old;
- if (place != NULL)
+ if (place != NULL && os->bfd_section != NULL)
{
asection *snew, **pps;
Index: ld/emultempl/mmo.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/mmo.em,v
retrieving revision 1.7
diff -u -p -r1.7 mmo.em
--- ld/emultempl/mmo.em 19 Jul 2002 02:56:59 -0000 1.7
+++ ld/emultempl/mmo.em 20 Jul 2002 13:35:42 -0000
@@ -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);
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.65
diff -u -p -r1.65 pe.em
--- ld/emultempl/pe.em 1 Jul 2002 08:07:31 -0000 1.65
+++ ld/emultempl/pe.em 20 Jul 2002 13:35:44 -0000
@@ -1668,7 +1668,7 @@ gld_${EMULATION_NAME}_place_orphan (file
stat_ptr = old;
- if (place != NULL)
+ if (place != NULL && os->bfd_section != NULL)
{
asection *snew, **pps;
- Bug with GNU ld, Pete Gonzalez, 2002/07/20
- Re: Bug with GNU ld,
Alan Modra <=