binutils-2.8 ld segmentation fault
Peter Barada
pbarada@wavemark.com
Thu Sep 18 13:18:00 GMT 1997
I've stumbled across a segmentation violation in ld when I try to
link for PowerPc using ld. I've cut the job down to a very simple file
which still causes a SIGSEGV. Anybody have any ideas as why and a fix?
(I'll try to figure out what hold_use is for, and hack around it).
Any ideas???
- --
Peter Barada pbarada@wavemark.com
Wizard 617-270-7098 x1226
WaveMark Technologies, Inc. 617-270-0193 (fax)
"Real men know that you should never attempt to accomplish with words
what you can do with a flame thrower" --Bruce Ferstein
/* the code fragment from ld/ee32ppc.c: */
gldelf32ppc_place_section (s)
lang_statement_union_type *s;
{
lang_output_section_statement_type *os;
if (s->header.type != lang_output_section_statement_enum)
return;
os = &s->output_section_statement;
if (strcmp (os->name, hold_section->name) == 0
&& ((hold_section->flags & (SEC_LOAD | SEC_ALLOC))
== (os->bfd_section->flags & (SEC_LOAD | SEC_ALLOC)))) /* <--- */
hold_use = os;
/* ... */
os->bfd_section is null, so a dereference of it to get flags causes a
SIGSEGV.
- --- confid.status:
#!/bin/sh
# This file was generated automatically by configure. Do not edit.
# This directory was configured as follows:
./configure --target=ppc-rtems-eabi --prefix=/usr/local/wave \
--exec-prefix=/usr/local/wave/ppc --program-prefix=ppc_ --host=i586-linux-gnu --nfp
#
- --- link.cmd:
SECTIONS {
.text : {}
.data : {}
.bss : {}
}
- --- Makefile:
CC= ppc_gcc
AS= ppc_as
LD= ppc_ld
AR= ppc_ar
CFLAGS= -c -g -D__ppc
CFLAGS1= -S -g -mcpu=403
INCLUDES = -I $(PPC_PATH)/include
AFLAGS=
LFLAGS= -T link.cmd
LIBFLAGS=
.s.o:
$(AS) -mregnames -o $*.o $*.s
all: simple.elf
clean:
rm -f *.o *.elf *.srec *.map *.dis *.out *.lst *.i
OFILES = simple.o
simple.elf: $(OFILES)
$(LD) $(LFLAGS) -o simple.elf $(OFILES) $(LIBFLAGS) -Map simple.map
real_simple.elf: $(OFILES)
$(LD) -o real_simple.elf $(OFILES) $(LIBFLAGS) -Map real_simple.map
- --- simple.s:
.text
.align 4
.globl START, _START, _boot, _start, _theend
START:
_START:
_boot:
_start:
ori r3, r3, 42
b $
_theend:
- --- gdb.dump:
(gdb) run
Starting program: /usr/local/wave/ppc/bin/ppc_ld -T link.cmd -o simple.elf simple.o -Map simple.map
warning: Unable to find dynamic linker breakpoint function.
warning: GDB will be unable to debug shared library initializers
warning: and track explicitly loaded dynamic code.
Program received signal SIGSEGV, Segmentation fault.
0x8057229 in gldelf32ppc_place_section (s=0x80ad460) at eelf32ppc.c:794
(gdb) up
#1 0x804e00f in lang_for_each_statement_worker (
func=0x80571f0 <gldelf32ppc_place_section>, s=0x80ad3c8) at ldlang.c:188
(gdb) down
#0 0x8057229 in gldelf32ppc_place_section (s=0x80ad460) at eelf32ppc.c:794
(gdb) where
#0 0x8057229 in gldelf32ppc_place_section (s=0x80ad460) at eelf32ppc.c:794
#1 0x804e00f in lang_for_each_statement_worker (
func=0x80571f0 <gldelf32ppc_place_section>, s=0x80ad3c8) at ldlang.c:188
#2 0x804e0cd in lang_for_each_statement (
func=0x80571f0 <gldelf32ppc_place_section>) at ldlang.c:232
#3 0x8056e83 in gldelf32ppc_place_orphan (file=0x80ad564, s=0x80b7d98)
at eelf32ppc.c:634
#4 0x8054e50 in ldemul_place_orphan (file=0x80ad564, s=0x80b7d98)
at ldemul.c:131
#5 0x80507fa in lang_place_orphans () at ldlang.c:2806
#6 0x8050b59 in lang_process () at ldlang.c:3108
#7 0x8052402 in main (argc=8, argv=0xbffff9e0) at ldmain.c:313
#8 0x80493fb in _start ()
(gdb) p *os
$1 = {header = {next = 0x80ad4cc, type = lang_output_section_statement_enum},
addr_tree = 0x0, children = {head = 0x0, tail = 0x80ad46c}, memspec = 0x0,
next = 0x80ad4cc, name = 0x80b1840 ".text", processed = false,
bfd_section = 0x0, flags = 0, sectype = normal_section, region = 0x80ad4ac,
block_value = 1, fill = 0, subsection_alignment = -1,
section_alignment = -1, load_base = 0x0, phdrs = 0x0}
(gdb) p os->bfd_section
$2 = (asection *) 0x0
(gdb)
More information about the crossgcc
mailing list