diff mbox

CFT: Move unwinder to toplevel libgcc

Message ID ydd39ibv2b0.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth July 12, 2011, 5:25 p.m. UTC
Steve,

> /wsp/sje/gcc_git/src/gcc/libstdc++-v3/libsupc++/eh_call.cc:34:23: fatal error: unwind-pe.h: No such file or directory
> compilation terminated.
> make[4]: *** [eh_call.lo] Error 1
> make[4]: Leaving directory `/wsp/sje/gcc_git/build-ia64-hp-hpux11.23-gcc/obj_gcc/ia64-hp-hpux11.23/libstdc++-v3/libsupc++'
> make[3]: *** [all-recursive] Error 1
>
> I think in my earlier build I was building C only (or maybe the compiler only) and that is why I didn't
> see this problem.
>
> I think the libstdc++ Makefile needs to add
>
> -I/wsp/sje/gcc_git/src/gcc/libstdc++-v3/../libgcc
>
> in addition (or instead of)
>
> -I/wsp/sje/gcc_git/src/gcc/libstdc++-v3/../gcc

this is strange: my patch already includes this snippet:


After rebuilding libstdc++-v3/configure, you should be fine.

	Rainer

Comments

Steve Ellcey July 12, 2011, 5:33 p.m. UTC | #1
On Tue, 2011-07-12 at 19:25 +0200, Rainer Orth wrote:

> After rebuilding libstdc++-v3/configure, you should be fine.
> 
> 	Rainer

Ah, I may have forgotten to run autoconf.  My original testing was with
a subversion workarea, I am now trying to do it in a git area that I
created and I may have forgotten to run autoconf in the new git area
after applying your patch.

Steve Ellcey
sje@cup.hp.com
Steve Ellcey July 13, 2011, 10:03 p.m. UTC | #2
Rainer,

I have successfully bootstrapped and tested the toplevel libgcc patch on
IA64 HP-UX.  When trying to build IA64 Linux the bootstrap failed with:


/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ar  rc libgcc.a $objects
/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ranlib libgcc.a
mv tmp-libgcc.map libgcc.map
# @multilib_flags@ is still needed because this may use
# /wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/xgcc -B/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/lib/ -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/include -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/sys-include    and -O2  -g -O2 -DIN_GCC   -DUSE_LIBUNWIND_EXCEPTIONS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -DUSE_GAS_SYMVER -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  directly.
# @multilib_dir@ is not really necessary, but sometimes it has
# more uses than just a directory name.
/bin/sh /wsp/sje/gcc_git/src/gcc/libgcc/../mkinstalldirs ./wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/xgcc -B/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/lib/ -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/include -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/sys-include    -O2  -g -O2 -DIN_GCC   -DUSE_LIBUNWIND_EXCEPTIONS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -DUSE_GAS_SYMVER -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,-h,libunwind.so.7 -Wl,-z,text -Wl,-z,defs -o /libunwind.so.7.tmp -g -O2 -B./  -lc && rm -f / && if [ -f /libunwind.so.7 ]; then mv -f /libunwind.so.7 /libunwind.so.7.backup; else true; fi && mv /libunwind.so.7.tmp /libunwind.so.7 && ln -s libunwind.so.7 /
/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: cannot open output file /libunwind.so.7.tmp: Permission denied
collect2: error: ld returned 1 exit status
make[3]: *** [libunwind.so] Error 1
make[3]: Target `all' not remade because of errors.
make[3]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/ia64-debian-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Target `all-stage1' not remade because of errors.
make[2]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
make[1]: *** [stage1-bubble] Error 2
make[1]: Target `stage3-bubble' not remade because of errors.
make[1]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
make: *** [bootstrap] Error 2

It looks like a prefix is missing somewhere since it is trying to access /libunwind.so.  This
may be something messed up in my build area again but I did run autoconf in libgcc so I am
not sure what is going on.  I'll dig around some more but I thought I would see if this looks
familiar to you.

Steve Ellcey
sje@cup.hp.com
Rainer Orth July 15, 2011, 9:06 a.m. UTC | #3
Steve,

> I have successfully bootstrapped and tested the toplevel libgcc patch on
> IA64 HP-UX.  When trying to build IA64 Linux the bootstrap failed with:

great, thanks.

> /bin/sh /wsp/sje/gcc_git/src/gcc/libgcc/../mkinstalldirs ./wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/xgcc -B/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/lib/ -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/include -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/sys-include    -O2  -g -O2 -DIN_GCC   -DUSE_LIBUNWIND_EXCEPTIONS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -DUSE_GAS_SYMVER -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,-h,libunwind.so.7 -Wl,-z,text -Wl,-z,defs -o /libunwind.so.7.tmp -g -O2 -B./  -lc && rm -f / && if [ -f /libunwind.so.7 ]; then mv -f /libunwind.so.7 /libunwind.so.7.backup; else true; fi && mv /libunwind.so.7.tmp /libunwind.so.7 && ln -s libunwind.so.7 /
> /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: cannot open output file /libunwind.so.7.tmp: Permission denied
> collect2: error: ld returned 1 exit status
[...]
> It looks like a prefix is missing somewhere since it is trying to access /libunwind.so.  This
> may be something messed up in my build area again but I did run autoconf in libgcc so I am
> not sure what is going on.  I'll dig around some more but I thought I would see if this looks
> familiar to you.

It didn't, but I now see what's going on: gcc/config.gcc has

*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
[...]
  tmake_file="t-slibgcc-elf-ver t-linux"

t-slibgcc-elf-ver has the whole shebang necessary to build versioned ELF
shared libraries, among others SHLIB_DIR which is missing above.  This
should be dealt with by using

tmake_file="$tmake_file t-slibgcc t-slibgcc-elf-ver"

in libgcc/config.host.

t-linux adds

SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver

but there's more SHLIB_* related stuff in the regular gcc/config ia64
t-* files used on ia64*-*-linux*:

ia64/t-ia64:SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64.ver
t-libunwind:SHLIB_LC = -lunwind -lc
ia64/t-glibc:SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-glibc.ver

This seems all so involved and entangled with the t-slibgcc* stuff that
it's probably best to keep out of this patch.  I'll try to come up with
something over the week, either fixing up this patch that it should
handle things correctly or splitting it out into its own, either
together with the rest of SHLIB_* handling or separate and on top of
that.

	Rainer
Rainer Orth July 18, 2011, 11:31 a.m. UTC | #4
Steve,

>> It looks like a prefix is missing somewhere since it is trying to access /libunwind.so.  This
>> may be something messed up in my build area again but I did run autoconf in libgcc so I am
>> not sure what is going on.  I'll dig around some more but I thought I would see if this looks
>> familiar to you.
>
> It didn't, but I now see what's going on: gcc/config.gcc has
>
> *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
> [...]
>   tmake_file="t-slibgcc-elf-ver t-linux"
>
> t-slibgcc-elf-ver has the whole shebang necessary to build versioned ELF
> shared libraries, among others SHLIB_DIR which is missing above.  This
> should be dealt with by using
>
> tmake_file="$tmake_file t-slibgcc t-slibgcc-elf-ver"
>
> in libgcc/config.host.
>
> t-linux adds
>
> SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
>
> but there's more SHLIB_* related stuff in the regular gcc/config ia64
> t-* files used on ia64*-*-linux*:
>
> ia64/t-ia64:SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64.ver
> t-libunwind:SHLIB_LC = -lunwind -lc
> ia64/t-glibc:SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-glibc.ver
>
> This seems all so involved and entangled with the t-slibgcc* stuff that
> it's probably best to keep out of this patch.  I'll try to come up with
> something over the week, either fixing up this patch that it should
> handle things correctly or splitting it out into its own, either
> together with the rest of SHLIB_* handling or separate and on top of
> that.

I had a fresh look and it seems this isn't as bad as it might have been:
the only SHLIB_ macros used are SHLIB_(DIR|OBJS|SOLINK|SLIBDIR_QUAL),
which are all present in libgcc/config/t-slibgcc and are substituted by
configure.  While one might split them out of t-slibgcc for reuse by
both libgcc_s and libunwind or also substitute them t-libunwind-elf,
this is probably overkill.  Could you please try to insert t-slibgcc in
front of t-libunwind-elf in the ia64*-*-linux* case in
libgcc/config.host?

Thanks.
        Rainer
Steve Ellcey July 18, 2011, 5:14 p.m. UTC | #5
On Mon, 2011-07-18 at 13:31 +0200, Rainer Orth wrote:
> Steve,

> I had a fresh look and it seems this isn't as bad as it might have been:
> the only SHLIB_ macros used are SHLIB_(DIR|OBJS|SOLINK|SLIBDIR_QUAL),
> which are all present in libgcc/config/t-slibgcc and are substituted by
> configure.  While one might split them out of t-slibgcc for reuse by
> both libgcc_s and libunwind or also substitute them t-libunwind-elf,
> this is probably overkill.  Could you please try to insert t-slibgcc in
> front of t-libunwind-elf in the ia64*-*-linux* case in
> libgcc/config.host?
> 
> Thanks.
>         Rainer

I tried this (here is the libgcc/config.host entry for ia64*-*-linux*):

ia64*-*-linux*)
        extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
        tmake_file="ia64/t-ia64 t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
        if test x$with_system_libunwind != xyes ; then
                tmake_file="${tmake_file} t-slibgcc t-libunwind-elf ia64/t-glibc-libunwind"
        fi
        md_unwind_header=ia64/linux-unwind.h
        ;;


The build still failed, but it failed in a different way.  I got:

/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/xgcc -B/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/lib/ -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/include -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/sys-include    -O2  -g -O2 -DIN_GCC   -DUSE_LIBUNWIND_EXCEPTIONS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -DUSE_GAS_SYMVER -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs  -o ./libgcc_s.so.1.tmp -g -O2 -B./ __divdf3_s.o __divsf3_s.o __divdi3_s.o __moddi3_s.o __udivdi3_s.o __umoddi3_s.o __divsi3_s.o __modsi3_s.o __udivsi3_s.o __umodsi3_s.o __save_stack_nonlocal_s.o __nonlocal_goto_s.o __restore_stack_nonlocal_s.o __trampoline_s.o _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o
 _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o tf-signs_s.o __divxf3_s.o _fixtfdi_s.o _fixunstfdi_s.o _floatditf_s.o enable-execute-stack_s.o unwind-sjlj_s.o unwind-c_s.o unwind-compat_s.o unwind-dw2-fde-compat_s.o emutls_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: ./libgcc_s.so.1.tmp: version node not found for symbol _Unwind_Backtrace@GCC_3.3
/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/ia64-debian-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
make: *** [bootstrap] Error 2




Steve Ellcey
sje@cup.hp.com
Rainer Orth July 19, 2011, 10:47 a.m. UTC | #6
Steve,

> I tried this (here is the libgcc/config.host entry for ia64*-*-linux*):
>
> ia64*-*-linux*)
>         extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
>         tmake_file="ia64/t-ia64 t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
>         if test x$with_system_libunwind != xyes ; then
>                 tmake_file="${tmake_file} t-slibgcc t-libunwind-elf ia64/t-glibc-libunwind"
>         fi
>         md_unwind_header=ia64/linux-unwind.h
>         ;;
>
>
> The build still failed, but it failed in a different way.  I got:
>
> /wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/xgcc -B/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/./gcc/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ -B/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/lib/ -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/include -isystem /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/sys-include    -O2  -g -O2 -DIN_GCC   -DUSE_LIBUNWIND_EXCEPTIONS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -DUSE_GAS_SYMVER -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs  -o ./libgcc_s.so.1.tmp -g -O2 -B./ __divdf3_s.o __divsf3_s.o __divdi3_s.o __moddi3_s.o __udivdi3_s.o __umoddi3_s.o __divsi3_s.o __modsi3_s.o __udivsi3_s.o __umodsi3_s.o __save_stack_nonlocal_s.o __nonlocal_goto_s.o __restore_stack_nonlocal_s.o __trampoline_s.o _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o
>  _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o tf-signs_s.o __divxf3_s.o _fixtfdi_s.o _fixunstfdi_s.o _floatditf_s.o enable-execute-stack_s.o unwind-sjlj_s.o unwind-c_s.o unwind-compat_s.o unwind-dw2-fde-compat_s.o emutls_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
> /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: ./libgcc_s.so.1.tmp: version node not found for symbol _Unwind_Backtrace@GCC_3.3
> /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: failed to set dynamic section sizes: Bad value
> collect2: error: ld returned 1 exit status
> make[3]: *** [libgcc_s.so] Error 1

unfortunately, I don't even have an idea what this error is supposed to
mean.  Seems to be an error ultimately due to bfd/elfxx-ia64.c
(elfNN_ia64_size_dynamic_sections) failing.

To debug this, I'd start by comparing the link lines for a vanilla build
with my patch, then, if no differences are apparent, check the object
files.

Sorry this is such a mess.

	Rainer
Steve Ellcey July 20, 2011, 10:26 p.m. UTC | #7
On Tue, 2011-07-19 at 12:47 +0200, Rainer Orth wrote:

> unfortunately, I don't even have an idea what this error is supposed to
> mean.  Seems to be an error ultimately due to bfd/elfxx-ia64.c
> (elfNN_ia64_size_dynamic_sections) failing.
> 
> To debug this, I'd start by comparing the link lines for a vanilla build
> with my patch, then, if no differences are apparent, check the object
> files.

Ah, I looked at the link lines and the standard build includes this in
the link line:

	-Wl,--version-script=libgcc.map

It is missing in the build I did with your patch.

Steve Ellcey
sje@cup.hp.com
Rainer Orth July 22, 2011, 3:12 p.m. UTC | #8
Steve,

> On Tue, 2011-07-19 at 12:47 +0200, Rainer Orth wrote:
>
>> unfortunately, I don't even have an idea what this error is supposed to
>> mean.  Seems to be an error ultimately due to bfd/elfxx-ia64.c
>> (elfNN_ia64_size_dynamic_sections) failing.
>> 
>> To debug this, I'd start by comparing the link lines for a vanilla build
>> with my patch, then, if no differences are apparent, check the object
>> files.
>
> Ah, I looked at the link lines and the standard build includes this in
> the link line:
>
> 	-Wl,--version-script=libgcc.map
>
> It is missing in the build I did with your patch.

now I understand what's happening: with t-slibgcc included in
libgcc/config.host, all the SHLIB_* variables gcc/libgcc.mvars (which
stem from gcc/config.gcc including t-slibgcc-elf-ver via the *-*-linux*
case) are overridden by the most generic defaults.

I think you'll need the following:

ia64*-*-linux*)
        extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
        # FIXME: Move to *-*-linux* once the SHLIB_* move is complete.
        tmake_file="t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
        tmake_file="$tmake_file ia64/t-ia64 t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
        if test x$with_system_libunwind != xyes ; then
                tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
        fi
        md_unwind_header=ia64/linux-unwind.h
        ;;

and a new libgcc/config/t-linux:

# Override t-slibgcc-elf-ver to export some libgcc symbols with
# the symbol versions that glibc used.
SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver

The t-slibgcc* fragments have been introduced to avoid the massive
duplication previously found there, but are equivalent to the current
gcc/config/t-slibgcc-elf-ver.

Perhaps you could give this a try?

Thanks.
        Rainer
Steve Ellcey July 22, 2011, 6:36 p.m. UTC | #9
On Fri, 2011-07-22 at 17:12 +0200, Rainer Orth wrote:

> I think you'll need the following:
> 
> ia64*-*-linux*)
>         extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
>         # FIXME: Move to *-*-linux* once the SHLIB_* move is complete.
>         tmake_file="t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
>         tmake_file="$tmake_file ia64/t-ia64 t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
>         if test x$with_system_libunwind != xyes ; then
>                 tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
>         fi
>         md_unwind_header=ia64/linux-unwind.h
>         ;;
> 
> and a new libgcc/config/t-linux:
> 
> # Override t-slibgcc-elf-ver to export some libgcc symbols with
> # the symbol versions that glibc used.
> SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
> 
> The t-slibgcc* fragments have been introduced to avoid the massive
> duplication previously found there, but are equivalent to the current
> gcc/config/t-slibgcc-elf-ver.
> 
> Perhaps you could give this a try?
> 
> Thanks.
>         Rainer

This died with:


make[3]: *** No rule to make target `/wsp/sje/gcc_git/src/gcc/libgcc/config/libgcc-glibc.ver', needed by `libgcc.map'.  Stop.
make[3]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/ia64-debian-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
make: *** [bootstrap] Error 2

I think I need to copy gcc/config/ia64/libgcc-glibc.ver over to libgcc/config/ia64/libgcc-glibc.ver
and modify SHLIB_MAPFILES to $(srcdir)/config/ia64/libgcc-glibc.ver.  So t-linux might need to be
t-ia64-linux or something like that since it would be IA64 specific now.  Or is there a better way
to fix this?  I will try my fix (leaving the t-linux name alone for now).


Steve Ellcey
sje@cup.hp.com
Rainer Orth July 22, 2011, 6:41 p.m. UTC | #10
Steve,

>> and a new libgcc/config/t-linux:
>> 
>> # Override t-slibgcc-elf-ver to export some libgcc symbols with
>> # the symbol versions that glibc used.
>> SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver

> This died with:
>
>
> make[3]: *** No rule to make target `/wsp/sje/gcc_git/src/gcc/libgcc/config/libgcc-glibc.ver', needed by `libgcc.map'.  Stop.
> make[3]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/ia64-debian-linux-gnu/libgcc'
> make[2]: *** [all-stage1-target-libgcc] Error 2
> make[2]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
> make[1]: *** [stage1-bubble] Error 2
> make[1]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
> make: *** [bootstrap] Error 2
>
> I think I need to copy gcc/config/ia64/libgcc-glibc.ver over to libgcc/config/ia64/libgcc-glibc.ver
> and modify SHLIB_MAPFILES to $(srcdir)/config/ia64/libgcc-glibc.ver.  So t-linux might need to be
> t-ia64-linux or something like that since it would be IA64 specific now.  Or is there a better way
> to fix this?  I will try my fix (leaving the t-linux name alone for now).

I'm an idiot: I've just copied the relevant lines from
gcc/config/t-linux, forgetting that libgcc-glibc.ver still lives in
gcc/config.

ibgcc/config/t-linux should be

# Override t-slibgcc-elf-ver to export some libgcc symbols with
# the symbol versions that glibc used.
SHLIB_MAPFILES += $(gcc_srcdir)/config/libgcc-glibc.ver

instead.

AFAICS, you will need both the generic gcc/config/libgcc-glibc.ver and
gcc/config/ia64/libgcc-glibc.ver.

	Rainer
Steve Ellcey July 22, 2011, 9:33 p.m. UTC | #11
On Fri, 2011-07-22 at 20:41 +0200, Rainer Orth wrote:

> I'm an idiot: I've just copied the relevant lines from
> gcc/config/t-linux, forgetting that libgcc-glibc.ver still lives in
> gcc/config.
> 
> ibgcc/config/t-linux should be
> 
> # Override t-slibgcc-elf-ver to export some libgcc symbols with
> # the symbol versions that glibc used.
> SHLIB_MAPFILES += $(gcc_srcdir)/config/libgcc-glibc.ver
> 
> instead.
> 
> AFAICS, you will need both the generic gcc/config/libgcc-glibc.ver and
> gcc/config/ia64/libgcc-glibc.ver.
> 
> 	Rainer


Well, I see "-Wl,--version-script=libgcc.map" on the link line now but I
still get an error during the link:

/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: ./libgcc_s.so.1.tmp: version node not found for symbol _Unwind_GetBSP@GCC_3.3.2
/wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/ia64-debian-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
make: *** [bootstrap] Error 2

I think the contents of the map file may be wrong.  This error involves a different symbol then when the
mapfile was missing.

>From the log file:

sed -e 's/__PFX__/__/g' < /wsp/sje/gcc_git/src/gcc/libgcc/libgcc-std.ver.in > libgcc-std.ver
cat libgcc-std.ver /wsp/sje/gcc_git/src/gcc/libgcc/../gcc/config/libgcc-glibc.ver | ...

I am not sure I am getting the right libgcc-*.ver files yet.  I think I need gcc/config/ia64/libgcc-glibc.ver
and/or gcc/config/ia64/libgcc-ia64.ver and I am not sure I am getting them.

I do see:

echo SHLIB_MAPFILES = 'libgcc-std.ver $(gcc_srcdir)/config/libgcc-glibc.ver $(gcc_srcdir)/config/ia64/libgcc-ia64.ver $(gcc_srcdir)/config/ia64/libgcc-glibc.ver' >> tmp-libgcc.mvars

So maybe I am getting the right files, I'm just not sure.

Steve Ellcey
sje@cup.hp.com
Rainer Orth July 25, 2011, 4:51 p.m. UTC | #12
Steve,

> Well, I see "-Wl,--version-script=libgcc.map" on the link line now but I
> still get an error during the link:
>
> /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: ./libgcc_s.so.1.tmp: version node not found for symbol _Unwind_GetBSP@GCC_3.3.2
> /wsp/sje/gcc_git/gcc-ia64-debian-linux-gnu-gcc/ia64-debian-linux-gnu/bin/ld: failed to set dynamic section sizes: Bad value
> collect2: error: ld returned 1 exit status
> make[3]: *** [libgcc_s.so] Error 1
> make[3]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc/ia64-debian-linux-gnu/libgcc'
> make[2]: *** [all-stage1-target-libgcc] Error 2
> make[2]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
> make[1]: *** [stage1-bubble] Error 2
> make[1]: Leaving directory `/wsp/sje/gcc_git/build-ia64-debian-linux-gnu-gcc/obj_gcc'
> make: *** [bootstrap] Error 2
>
> I think the contents of the map file may be wrong.  This error involves a different symbol then when the
> mapfile was missing.

I'm convinced now that this is the wrong approach.  All we need for
libunwind is a couple of common definitions that happen to only live in
t-slibgcc at the moment.  But including t-slibgcc and dependencies opens
a can of worms, so it's far easier to just provide the definitions
t-libunwind-elf needs ourselves.  So could you

* remove all the t-slibgcc* and related files (t-linux) from tmake_file
  in libgcc/config.host and

* add the following at the top of libgcc/config/t-libunwind-elf:

SHLIB_SOLINK = @shlib_base_name@.so
SHLIB_OBJS = @shlib_objs@
SHLIB_DIR = @multilib_dir@
SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@

As you can see, these four variables (the only SHLIB_* ones
t-libunwind-elf uses) are substituted by libgcc/Makefile.in and are
completely generic.

I'll be working on the SHLIB_* move to toplevel libgcc next, so if all
else fails, we could handle all that SHLIB stuff there.

Thanks.
        Rainer
diff mbox

Patch

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -685,9 +685,9 @@  AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
   fi
 
   # Stuff in the actual top level.  Currently only used by libsupc++ to
-  # get unwind* headers from the gcc dir.
-  #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
-  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
+  # get unwind* headers from the libgcc dir.
+  #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc -I$(toplevel_srcdir)/include'
+  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc'
 
   # Now, export this to all the little Makefiles....
   AC_SUBST(GLIBCXX_INCLUDES)