Your message dated Sun, 16 Oct 2011 22:00:51 -0500
with message-id <[email protected]>
and subject line Re: ld: Segfault when generating map file.
has caused the Debian Bug report #422147,
regarding ld: Segfault when generating map file.
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
422147: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=422147
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: binutils
Version: 2.17.20070210cvs-1
Severity: important

Hi,

When building openipmi 2.0.7-1 and trying to make a shared library and
generating a map file, ld segfaults:
x86_64-linux-gnu-gcc -shared  .libs/md5.o .libs/md2.o .libs/ipmi_auth.o 
.libs/ipmi_malloc.o .libs/ilist.o .libs/locks.o .libs/hash.o 
.libs/locked_list.o .libs/os_handler.o  -lcurses  -Wl,-Map 
-Wl,libOpenIPMIutils.map -Wl,-soname -Wl,libOpenIPMIutils.so.0 -o 
.libs/libOpenIPMIutils.so.0.0.1
collect2: ld terminated with signal 11 [Segmentation fault]
Which generated this command:
/usr/bin/ld --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -shared -o 
.libs/libOpenIPMIutils.so.0.0.1 
/usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib/crti.o 
/usr/lib/gcc/x86_64-linux-gnu/4.1.3/crtbeginS.o 
-L/usr/lib/gcc/x86_64-linux-gnu/4.1.3 -L/usr/lib/gcc/x86_64-linux-gnu/4.1.3 
-L/usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib -L/lib/../lib 
-L/usr/lib/../lib .libs/ipmi_malloc.o -Map libOpenIPMIutils.map -lgcc 
--as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed 
/usr/lib/gcc/x86_64-linux-gnu/4.1.3/crtendS.o 
/usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib/crtn.o

It seems this is the minimal command to reproduce it:
ld -o .libs/libOpenIPMIutils.so.0.0.1  .libs/ipmi_malloc.o -Map file

This only seems to be trigger by ipmi_malloc.o, which has a common
symbol: malloc_os_hnd.  And it seems to be having the problems when
it tries to print that to the map file.

ltrace shows:
bfd_demangle(0x689100, 0x6a24da, 3, 0, 10)       = 0
fputs(NULL, 0x688ec0 <unfinished ...>

Core was generated by `/usr/bin/ld -o .libs/libOpenIPMIutils.so.0.0.1 
.libs/ipmi_malloc.o -Map file'.
Program terminated with signal 11, Segmentation fault.
#0  0x00002b0f554839f0 in strlen () from /lib/libc.so.6
(gdb) bt
#0  0x00002b0f554839f0 in strlen () from /lib/libc.so.6
#1  0x00002b0f5546d23e in fputs () from /lib/libc.so.6
#2  0x0000000000421124 in vfinfo (fp=0x688ec0, fmt=0x43c355 "",
    arg=0x7fff55bc7460, is_warning=0) at ../../ld/ldmisc.c:400
#3  0x00000000004216e2 in minfo (fmt=0x43c353 "%s") at ../../ld/ldmisc.c:483
#4  0x00000000004159af in lang_one_common (h=0x68b9c0, info=0x0)
    at ../../ld/ldlang.c:5272
#5  0x00002b0f5513b8ed in bfd_hash_traverse (table=0x68b4a0,
    func=0x4157eb <lang_one_common>, info=0x0) at ../../bfd/hash.c:582
#6  0x00002b0f5513c20e in bfd_link_hash_traverse (table=0x68b4a0,
    func=0x4157eb <lang_one_common>, info=0x0) at ../../bfd/linker.c:612
#7  0x00000000004157b9 in lang_common () at ../../ld/ldlang.c:5204
#8  0x0000000000416424 in lang_process () at ../../ld/ldlang.c:5741
#9  0x000000000041a442 in main (argc=6, argv=0x7fff55bc7868)
    at ../../ld/ldmain.c:518
(gdb) frame 2
#2  0x0000000000421124 in vfinfo (fp=0x688ec0, fmt=0x43c355 "",
    arg=0x7fff55bc7460, is_warning=0) at ../../ld/ldmisc.c:400
400                   fprintf (fp, "%s", va_arg (arg, char *));
(gdb) frame 4
#4  0x00000000004159af in lang_one_common (h=0x68b9c0, info=0x0)
    at ../../ld/ldlang.c:5272
5272          minfo ("%s", name);
(gdb) p name
$2 = 0x0
(gdb) p h->root.string
$3 = 0x6a24da "malloc_os_hnd"


When debbuging inside bfd_demangle() I get:
bfd_demangle (abfd=0x689100, name=0x6a24da "malloc_os_hnd", options=3)
    at ../../bfd/bfd.c:1729
[...]
1756      res = cplus_demangle (name, options);
(gdb) p res
$3 = 0x0

And in cplus_demangle():
cplus_demangle (mangled=0x6a24da "malloc_os_hnd", options=3)
    at ../../libiberty/cplus-dem.c:851

Which goes to:
cplus_demangle_v3 (mangled=0x6a24da "malloc_os_hnd", options=259)
    at ../../libiberty/cp-demangle.c:4182
4182      return d_demangle (mangled, options, &alc);
(gdb) s
d_demangle (mangled=0x6a24da "malloc_os_hnd", options=259, palc=0x7fffdf0a7918)
    at ../../libiberty/cp-demangle.c:4023
4023      d_growable_string_init (&dgs, 0);
(gdb) n
4025      status = d_demangle_callback (mangled, options,
(gdb) s
d_demangle_callback (mangled=0x6a24da "malloc_os_hnd", options=259,
    callback=0x2b14cbcf3797 <d_growable_string_callback_adapter>,
    opaque=0x7fffdf0a78c0) at ../../libiberty/cp-demangle.c:3948
3948      if (mangled[0] == '_' && mangled[1] == 'Z')
(gdb) n
3950      else if (strncmp (mangled, "_GLOBAL_", 8) == 0
(gdb)
3967          if ((options & DMGL_TYPES) == 0)
(gdb)
3968            return 0;

This return 0 will result in it returning NULL.

I have no idea where it's going wrong.


Kurt



--- End Message ---
--- Begin Message ---
Version: 2.17cvs20070426-7

Kurt Roeckx wrote:

> collect2: ld terminated with signal 11 [Segmentation fault]
[...]
> ld -o .libs/libOpenIPMIutils.so.0.0.1  .libs/ipmi_malloc.o -Map file
[...]
> #4  0x00000000004159af in lang_one_common (h=0x68b9c0, info=0x0)
>     at ../../ld/ldlang.c:5272
> 5272          minfo ("%s", name);
> (gdb) p name
> $2 = 0x0

Fixed by binutils-2_18~548 (* ldlang.c (lang_one_common): Likewise.,
2007-04-28), presumably.  Thanks again for your help.


--- End Message ---

Reply via email to