Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 5 Jan 2015 23:48:50 -0800
From: Isaac Dunham <>
Subject: musl built with pcc yields segfaults in dynlink.c

I'm trying to get a pcc-built that works.
With the latest PCC, musl builds (lib/ and the result will display
the proper messages if run from the command line without arguments.
However, if I try to run a program with it 
(even via -Wl,-dynamic-linker,`pwd`/lib/, I get a segfault
in src/ldso/dynlink.c:
(gdb) where
#0  sysv_hash (s0=0x0, s0=0x0) at src/ldso/dynlink.c:177
#1  0xb7f6f747 in find_sym (dso=0xbffffb18, rel=0xb7ffe1d4 <.L1502>, 
    rel_size=<unknown type>, stride=<unknown type>, dso=0xbffffb18, 
    rel=0xb7ffe1d4 <.L1502>, rel_size=<unknown type>, stride=<unknown type>)
    at src/ldso/dynlink.c:251
    #2  0xb7f6f916 in do_relocs () at src/ldso/dynlink.c:308
    Backtrace stopped: frame did not save the PC

I'm using Alpine Linux edge, recently updated, with linux-vanilla.

Compiling pcc:
#from pcc cvs tip
./configure --prefix=/usr --build=i486-alpine-linux-musl \
--target=i486-alpine-linux-musl --enable-tls --enable-native
make install
#from pcc-libs cvs tip
cp ../pcc/config.guess ../pcc/config.sub ./
cd libpcc/
for f in cmpdi2.c divdi3.c fixdfdi.c fixsfdi.c fixunsdfdi.c fixunssfdi.c \
	floatdidf.c floatdisf.c floatunsdidf.c moddi3.c muldi3.c negdi2.c \
	qdivrem.c ucmpdi2.c udivdi3.c umoddi3.c cxmuldiv.c ashldi3.c ashrdi3.c \
	lshrdi3.c _alloca.c unwind.c ssp.c
    do hideintern.sed -i $f

export CFLAGS=-Os -fPIC
./configure --prefix=/usr --build=i486-alpine-linux-musl \
make install

Compiling musl:
#from git tip
CC=pcc ./configure --target=i486 --disable-static
#add -g to CFLAGS, probably enable-debug is better

Testing musl:
gcc -Wl,-dynamic-linker,`pwd`/lib/ test.c

hideintern.sed is how I'm adding the 
stuff to libpcc.a.

What would be most helpful for debugging?

Isaac Dunham

View attachment "hideintern.sed" of type "text/plain" (539 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.