Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 411677 (PR52990) - cross-ia64-unknown-linux-gnu/gcc: libgcc.a has undefined references to __libunwind_* symbols
Summary: cross-ia64-unknown-linux-gnu/gcc: libgcc.a has undefined references to __libu...
Status: RESOLVED FIXED
Alias: PR52990
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/PR52990
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-12 03:51 UTC by Michael Kosarev
Modified: 2012-04-14 22:31 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Output of emerge --info on CHOST (emergeinfo.log,5.92 KB, text/plain)
2012-04-12 03:55 UTC, Michael Kosarev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kosarev 2012-04-12 03:51:26 UTC
How to reproduce:
crossdev -t ia64-unknown-linux-gnu

cross-glibc fails on linking stage (tried 2.12-2.14 versions):
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_Backtrace@GCC_3.3':
(.text+0x22): undefined reference to `__libunwind_Unwind_Backtrace'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_DeleteException@GCC_3.0':
(.text+0xa2): undefined reference to `__libunwind_Unwind_DeleteException'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_FindEnclosingFunction@GCC_3.3':
(.text+0x122): undefined reference to `__libunwind_Unwind_FindEnclosingFunction'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_ForcedUnwind@GCC_3.0':
(.text+0x1a2): undefined reference to `__libunwind_Unwind_ForcedUnwind'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_GetCFA@GCC_3.3':
(.text+0x222): undefined reference to `__libunwind_Unwind_GetCFA'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_GetBSP@GCC_3.3.2':
(.text+0x2a2): undefined reference to `__libunwind_Unwind_GetBSP'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_GetGR@GCC_3.0':
(.text+0x322): undefined reference to `__libunwind_Unwind_GetGR'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_GetIP@GCC_3.0':
(.text+0x3a2): undefined reference to `__libunwind_Unwind_GetIP'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_GetIPInfo':
(.text+0x422): undefined reference to `__libunwind_Unwind_GetIP'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_GetLanguageSpecificData@GCC_3.0':
(.text+0x4a2): undefined reference to `__libunwind_Unwind_GetLanguageSpecificData'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_GetRegionStart@GCC_3.0':
(.text+0x522): undefined reference to `__libunwind_Unwind_GetRegionStart'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_RaiseException@GCC_3.0':
(.text+0x5a2): undefined reference to `__libunwind_Unwind_RaiseException'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_Resume@GCC_3.0':
(.text+0x622): undefined reference to `__libunwind_Unwind_Resume'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_Resume_or_Rethrow@GCC_3.3':
(.text+0x6a2): undefined reference to `__libunwind_Unwind_Resume_or_Rethrow'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_SetGR@GCC_3.0':
(.text+0x722): undefined reference to `__libunwind_Unwind_SetGR'
/usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a(unwind-compat.o): In function `_Unwind_SetIP@GCC_3.0':
(.text+0x7a2): undefined reference to `__libunwind_Unwind_SetIP'
collect2: ld returned 1 exit status
make[2]: *** [/var/tmp/portage/cross-ia64-unknown-linux-gnu/glibc-2.14.1-r2/work/build-default-ia64-unknown-linux-gnu-nptl/elf/sln] Error 1

Output of readelf -Ws unwind-compat.o from /usr/lib/gcc/ia64-unknown-linux-gnu/4.5.3/libgcc.a:
Symbol table '.symtab' contains 54 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    5 
     3: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 
     4: 0000000000000000     0 SECTION LOCAL  DEFAULT    4 
     5: 0000000000000000     0 SECTION LOCAL  DEFAULT    6 
     6: 0000000000000000     0 SECTION LOCAL  DEFAULT    8 
     7: 0000000000000000     0 SECTION LOCAL  DEFAULT    9 
     8: 0000000000000000    80 FUNC    GLOBAL DEFAULT    1 _Unwind_Backtrace
     9: 0000000000000080    80 FUNC    GLOBAL DEFAULT    1 _Unwind_DeleteException
    10: 0000000000000100    80 FUNC    GLOBAL DEFAULT    1 _Unwind_FindEnclosingFunction
    11: 0000000000000180    80 FUNC    GLOBAL DEFAULT    1 _Unwind_ForcedUnwind
    12: 0000000000000200    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetCFA
    13: 0000000000000280    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetBSP
    14: 0000000000000300    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetGR
    15: 0000000000000380    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetIP
    16: 0000000000000480    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetLanguageSpecificData
    17: 0000000000000500    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetRegionStart
    18: 0000000000000580    80 FUNC    GLOBAL DEFAULT    1 _Unwind_RaiseException
    19: 0000000000000600    80 FUNC    GLOBAL DEFAULT    1 _Unwind_Resume                                                                                                                                             
    20: 0000000000000680    80 FUNC    GLOBAL DEFAULT    1 _Unwind_Resume_or_Rethrow                                                                                                                                  
    21: 0000000000000700    80 FUNC    GLOBAL DEFAULT    1 _Unwind_SetGR                                                                                                                                              
    22: 0000000000000780    80 FUNC    GLOBAL DEFAULT    1 _Unwind_SetIP                                                                                                                                              
    23: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_Backtrace                                                                                                                               
    24: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_DeleteException                                                                                                                         
    25: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_FindEnclosingFunction                                                                                                                   
    26: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_ForcedUnwind
    27: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_GetCFA
    28: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_GetBSP
    29: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_GetGR
    30: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_GetIP
    31: 0000000000000400    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetIPInfo
    32: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_GetLanguageSpecificData
    33: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_GetRegionStart
    34: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_RaiseException
    35: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_Resume
    36: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_Resume_or_Rethrow
    37: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_SetGR
    38: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __libunwind_Unwind_SetIP
    39: 0000000000000000    80 FUNC    GLOBAL DEFAULT    1 _Unwind_Backtrace@GCC_3.3
    40: 0000000000000080    80 FUNC    GLOBAL DEFAULT    1 _Unwind_DeleteException@GCC_3.0
    41: 0000000000000100    80 FUNC    GLOBAL DEFAULT    1 _Unwind_FindEnclosingFunction@GCC_3.3
    42: 0000000000000180    80 FUNC    GLOBAL DEFAULT    1 _Unwind_ForcedUnwind@GCC_3.0
    43: 0000000000000200    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetCFA@GCC_3.3
    44: 0000000000000280    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetBSP@GCC_3.3.2
    45: 0000000000000300    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetGR@GCC_3.0
    46: 0000000000000380    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetIP@GCC_3.0
    47: 0000000000000480    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetLanguageSpecificData@GCC_3.0
    48: 0000000000000500    80 FUNC    GLOBAL DEFAULT    1 _Unwind_GetRegionStart@GCC_3.0
    49: 0000000000000580    80 FUNC    GLOBAL DEFAULT    1 _Unwind_RaiseException@GCC_3.0
    50: 0000000000000600    80 FUNC    GLOBAL DEFAULT    1 _Unwind_Resume@GCC_3.0
    51: 0000000000000680    80 FUNC    GLOBAL DEFAULT    1 _Unwind_Resume_or_Rethrow@GCC_3.3
    52: 0000000000000700    80 FUNC    GLOBAL DEFAULT    1 _Unwind_SetGR@GCC_3.0
    53: 0000000000000780    80 FUNC    GLOBAL DEFAULT    1 _Unwind_SetIP@GCC_3.0
Comment 1 Michael Kosarev 2012-04-12 03:55:45 UTC
Created attachment 308601 [details]
Output of emerge --info on CHOST
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2012-04-14 18:46:45 UTC
Some observations:

gcc does not install libunwind.a/.so when --disable-shared flag is passed:

gcc-4.6.2/work/build/ia64-unknown-linux-gnu/libgcc/Makefile:

    ifeq ($(enable_shared),yes)
      iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
    install-shared = install-shared
    ifneq ($(LIBUNWIND),)
      install-libunwind = install-libunwind
    endif
    ...
    install-leaf: $(install-shared) $(install-libunwind)

and it makes glibc sad.

@toolchain ninjas:
In --disable-shared libunwind* contents should sit in libgcc.a, right?
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2012-04-14 20:37:39 UTC
I guess it's a simple as
    libgcc-objects += $(libunwind-objects)
but i can't figure where to plug it to not break all the targets.
Comment 4 SpanKY gentoo-dev 2012-04-14 21:18:14 UTC
glibc build broke when this commit was made:
http://sources.gentoo.org/sys-libs/glibc/files/eblits/src_compile.eblit?r1=1.19&r2=1.20

(In reply to comment #3)

that wouldn't help because the static unwind objects do not contain __libunwind_xxx symbols.  they only show up in the shared objects.

in an ia64 build with shared libs, libgcc.a wouldn't refer to __libunwind_xxx either.  only libgcc_s.so would.  nor would libunwind.a contain the symbols, only libunwind.so.

__libunwind_Unwind_GetBSP  ./libgcc_s.so.1
__libunwind_Unwind_GetBSP  ./unwind-compat_s.o
__libunwind_Unwind_GetBSP  ./libunwind.so.7
__libunwind_Unwind_GetBSP  ./unwind-ia64_s.o
Comment 5 SpanKY gentoo-dev 2012-04-14 22:04:02 UTC
gcc could be made to work ... but i'm not sure if it's worth it:
 - if enable_shared == no, then add the unwind objs to libgcc.a
 - if enable_shared == no, build unwind-ia64.o with -DLIBUNWIND_ALIASES
 - edit gcc/config/ia64/unwind-ia64.c and change it to:
   ... && (defined(SHARED) || defined(LIBUNWIND_ALIASES)) && ...

i've restored the glibc hack in the mean time:
http://sources.gentoo.org/sys-libs/glibc/files/eblits/src_compile.eblit?r1=1.23&r2=1.24