mailing list of musl libc
 help / color / mirror / code / Atom feed
* Hidden symbol '__muldc3' referenced when compiled with gcc-4.8.1
@ 2013-09-04 15:07 邓尧
  2013-09-04 15:51 ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: 邓尧 @ 2013-09-04 15:07 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1835 bytes --]

Hi,

I'm trying to build a musl based toolchain. My approach works well with
gcc-4.7.3, however when upgrading gcc to 4.8.1, I run into such problem.

Firstly comiple cross binutils:
    ../binutils-2.23.2/configure --prefix=... --target=...
--with-sysroot=...
    make && make DESTDIR=... install
Then compile cross gcc (compiler only)
    ../gcc-4.8.1/configure --prefix --target=... --with-sysroot=...
--enable-languages=c
    make all-gcc && make DESTDIR=... install-gcc
Compile musl-0.9.13:
    CC=$TARGET-gcc CFLAGS=-O2 ./configure --prefix=..
    make && make DESTDIR=... install
Finally compile fully working cross compiler, this is where I got problems:
    ../gcc-4.8.1/configure --prefix --target=... --with-sysroot=...
--enable-languages=c
    make && make DESTDIR=... install
In the final step, the build system will check whether the compiler (xgcc)
could create executable. xgcc failed when linking, showed some error
messages like the following:
x86_64-unknown-linux-musl/bin/ld: a.out: hidden symbol `__muldc3' in
musl/build/cross-4.8.1-gcc/./gcc/libgcc.a(_muldc3.o) is referenced by DSO.

It seems libc.so is referencing some hidden symbol defined in libgcc.a. The
linking problem could be resolved by statically linking libgcc when libc is
statically linked, and dynamic link libgcc when libc is dynamic linked.
However the dynamic loader (ld-musl) refuses to load dynamic linked
executables, and shows the following error messages:
Error relocating /lib64/ld-musl-x86_64.so.1: __muldc3: symbol not found
Error relocating /lib64/ld-musl-x86_64.so.1: __mulsc3: symbol not found
Error relocating /lib64/ld-musl-x86_64.so.1: __mulxc3: symbol not found

Statically linked executables seem to be fine.

Not sure whether it's a bug in gcc or musl, or it's simply a mistake in my
building process. Any ideas ?

Thanks
Yao.

[-- Attachment #2: Type: text/html, Size: 2292 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hidden symbol '__muldc3' referenced when compiled with gcc-4.8.1
  2013-09-04 15:07 Hidden symbol '__muldc3' referenced when compiled with gcc-4.8.1 邓尧
@ 2013-09-04 15:51 ` Rich Felker
  2013-09-04 17:20   ` 邓尧
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2013-09-04 15:51 UTC (permalink / raw)
  To: musl

On Wed, Sep 04, 2013 at 11:07:35PM +0800, 邓尧 wrote:
> Hi,
> 
> I'm trying to build a musl based toolchain. My approach works well with
> gcc-4.7.3, however when upgrading gcc to 4.8.1, I run into such problem.
> 
> Firstly comiple cross binutils:
>     ../binutils-2.23.2/configure --prefix=... --target=...
> --with-sysroot=...
>     make && make DESTDIR=... install
> Then compile cross gcc (compiler only)
>     ../gcc-4.8.1/configure --prefix --target=... --with-sysroot=...
> --enable-languages=c
>     make all-gcc && make DESTDIR=... install-gcc
> Compile musl-0.9.13:
>     CC=$TARGET-gcc CFLAGS=-O2 ./configure --prefix=..
>     make && make DESTDIR=... install
> Finally compile fully working cross compiler, this is where I got problems:
>     ../gcc-4.8.1/configure --prefix --target=... --with-sysroot=...
> --enable-languages=c
>     make && make DESTDIR=... install
> In the final step, the build system will check whether the compiler (xgcc)
> could create executable. xgcc failed when linking, showed some error
> messages like the following:
> x86_64-unknown-linux-musl/bin/ld: a.out: hidden symbol `__muldc3' in
> musl/build/cross-4.8.1-gcc/./gcc/libgcc.a(_muldc3.o) is referenced by DSO.

More details on this would be helpful.

> It seems libc.so is referencing some hidden symbol defined in libgcc.a. The

What it means is that libc.so was linked incorrectly and does not have
its own (should be hidden) copy of __muldc3 and other libgcc functions
in it. Could you show us your config.mak from building musl?

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hidden symbol '__muldc3' referenced when compiled with gcc-4.8.1
  2013-09-04 15:51 ` Rich Felker
@ 2013-09-04 17:20   ` 邓尧
  2013-09-04 17:26     ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: 邓尧 @ 2013-09-04 17:20 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2384 bytes --]

>
>
> More details on this would be helpful.
>
1. build binutils
../binutils-2.23.2/configure --disable-nls
--prefix=/home/hoolala/musl/tools --disable-werror
--target=x86_64-unknown-linux-musl --with-sysroot=/home/hoolala/musl/sysroot
make && make install

2. build gcc (compiler only):
../gcc-4.8.1/configure --prefix=/home/hoolala/musl/tools
--target=x86_64-unknown-linux-musl
--with-sysroot=/home/hoolala/musl/sysroot --disable-plugin --disable-lto
--with-newlib --without-headers --with-local-prefix=/usr --disable-nls
--disable-multilib --disable-decimal-float --disable-threads
--disable-libmudflap --disable-libssp --disable-libgomp
--disable-libquadmath --enable-languages=c --disable-libstdcxx
--disable-static --enable-shared
make all-gcc && make install-gcc

3. build musl
./configure --prefix=/usr --libdir=/usr/lib/x86_64-unknown-linux-musl
--includedir=/usr/include --disable-gcc-wrapper
make && make DESTDIR=/home/hoolala/musl/sysroot install

4. build gcc:
this time, gcc is configure'd exactly the same as last time, but built &
installed with command:
make && make install


> > It seems libc.so is referencing some hidden symbol defined in libgcc.a.
> The
>
> What it means is that libc.so was linked incorrectly and does not have
> its own (should be hidden) copy of __muldc3 and other libgcc functions
> in it. Could you show us your config.mak from building musl?
>

The following is the generated config.mak

# This version of config.mak was generated by:
# ./configure --prefix=/usr --libdir=/usr/lib/x86_64-unknown-linux-musl
--includedir=/usr/include --disable-gcc-wrapper
# Any changes made here will be lost if configure is re-run
ARCH = x86_64
SUBARCH =
ASMSUBARCH =
prefix = /usr
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = /usr/lib/x86_64-unknown-linux-musl
includedir = /usr/include
syslibdir = /lib
CC = x86_64-unknown-linux-musl-gcc
CFLAGS= -pipe -fomit-frame-pointer -fno-unwind-tables
-fno-asynchronous-unwind-tables -Wa,--noexecstack
-Werror=implicit-function-declaration -Werror=implicit-int
-Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector -O2
CFLAGS_C99FSE = -std=c99 -nostdinc -ffreestanding
-fexcess-precision=standard -frounding-math
CFLAGS_MEMOPS = -fno-tree-loop-distribute-patterns
CPPFLAGS =
LDFLAGS = -Wl,--hash-style=both
CROSS_COMPILE =
LIBCC =
OPTIMIZE_GLOBS =
ALL_TOOLS =
TOOL_LIBS =




>
> Rich
>

[-- Attachment #2: Type: text/html, Size: 3328 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hidden symbol '__muldc3' referenced when compiled with gcc-4.8.1
  2013-09-04 17:20   ` 邓尧
@ 2013-09-04 17:26     ` Rich Felker
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2013-09-04 17:26 UTC (permalink / raw)
  To: musl

On Thu, Sep 05, 2013 at 01:20:50AM +0800, 邓尧 wrote:
> >
> >
> > More details on this would be helpful.
> >
> 1. build binutils
> .../binutils-2.23.2/configure --disable-nls
> --prefix=/home/hoolala/musl/tools --disable-werror
> --target=x86_64-unknown-linux-musl --with-sysroot=/home/hoolala/musl/sysroot
> make && make install
> 
> 2. build gcc (compiler only):
> .../gcc-4.8.1/configure --prefix=/home/hoolala/musl/tools
> --target=x86_64-unknown-linux-musl
> --with-sysroot=/home/hoolala/musl/sysroot --disable-plugin --disable-lto
> --with-newlib --without-headers --with-local-prefix=/usr --disable-nls
> --disable-multilib --disable-decimal-float --disable-threads
> --disable-libmudflap --disable-libssp --disable-libgomp
> --disable-libquadmath --enable-languages=c --disable-libstdcxx
> --disable-static --enable-shared
  ^^^^^^^^^^^^^^^^

Here is your problem. You built a gcc that's missing libgcc.a....

> make all-gcc && make install-gcc
> 
> 3. build musl
> ../configure --prefix=/usr --libdir=/usr/lib/x86_64-unknown-linux-musl
> --includedir=/usr/include --disable-gcc-wrapper
> make && make DESTDIR=/home/hoolala/musl/sysroot install
> 
> 4. build gcc:
> this time, gcc is configure'd exactly the same as last time, but built &
> installed with command:
> make && make install
> 
> 
> > > It seems libc.so is referencing some hidden symbol defined in libgcc.a.
> > The
> >
> > What it means is that libc.so was linked incorrectly and does not have
> > its own (should be hidden) copy of __muldc3 and other libgcc functions
> > in it. Could you show us your config.mak from building musl?
> >
> 
> The following is the generated config.mak
> 
> # This version of config.mak was generated by:
> # ./configure --prefix=/usr --libdir=/usr/lib/x86_64-unknown-linux-musl
> --includedir=/usr/include --disable-gcc-wrapper
> # Any changes made here will be lost if configure is re-run
> ARCH = x86_64
> SUBARCH =
> ASMSUBARCH =
> prefix = /usr
> exec_prefix = $(prefix)
> bindir = $(exec_prefix)/bin
> libdir = /usr/lib/x86_64-unknown-linux-musl
> includedir = /usr/include
> syslibdir = /lib
> CC = x86_64-unknown-linux-musl-gcc
> CFLAGS= -pipe -fomit-frame-pointer -fno-unwind-tables
> -fno-asynchronous-unwind-tables -Wa,--noexecstack
> -Werror=implicit-function-declaration -Werror=implicit-int
> -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector -O2
> CFLAGS_C99FSE = -std=c99 -nostdinc -ffreestanding
> -fexcess-precision=standard -frounding-math
> CFLAGS_MEMOPS = -fno-tree-loop-distribute-patterns
> CPPFLAGS =
> LDFLAGS = -Wl,--hash-style=both
> CROSS_COMPILE =
> LIBCC =
  ^^^^^^^^

So musl was unable to obtain and link to libgcc.a.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-04 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-04 15:07 Hidden symbol '__muldc3' referenced when compiled with gcc-4.8.1 邓尧
2013-09-04 15:51 ` Rich Felker
2013-09-04 17:20   ` 邓尧
2013-09-04 17:26     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).