Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOkOUefZEax6yNTK8hMTXzmuZc+By3P4SF2CbmuE8kF3wwDoFw@mail.gmail.com>
Date: Thu, 21 Jan 2016 14:05:41 -0500
From: N Jain <jain61@...il.com>
To: musl@...ts.openwall.com, Szabolcs Nagy <nsz@...t70.net>
Subject: Re: MUSL issue while loading C++ lib

Hi Szabolcs,

I am having one c and other cpp file and using g++ for linking.
I do have libgcc_s.so.1 lib added.

When I looked into generated elf I do see .so dependencies but order of
libgcc_s.so.1 is second.
I am assuming this is not the problem.

0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so]



>
> > these symbols should be defined in libgcc_s.so.1
> > which is linked to c++ code by gcc.
>


Also searching online I saw some issues with versions for
GLIBCXX but don't know how to confirm if this is not the problem with MUSL
toolchain I generated.

 ersion needs section '.gnu.version_r' contains 1 entries:
 Addr: 0x0000000000010634  Offset: 0x000634  Link: 4 (.dynstr)
  000000: Version: 1  File: libstdc++.so.6  Cnt: 3
  0x0010:   Name: GLIBCXX_3.4.9  Flags: none  Version: 4
  0x0020:   Name: GLIBCXX_3.4.11  Flags: none  Version: 3
  0x0030:   Name: GLIBCXX_3.4  Flags: none  Version: 2



> > sounds like a gcc toolchain issue, if you cannot
> > figure it out then post
>
> > echo 'int main(){}' |g++ -xc++ -
>

I am not sure where to issue this command ?



>
> > readelf -ld ./a.out
>

Result
------------

Elf file type is EXEC (Executable file)
Entry point 0x109fc
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX          0x000c08 0x00010c08 0x00010c08 0x00008 0x00008 R   0x4
  PHDR           0x000034 0x00010034 0x00010034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x00010114 0x00010114 0x00016 0x00016 R   0x1
      [Requesting program interpreter: /lib/ld-musl-arm.so.1]
  LOAD           0x000000 0x00010000 0x00010000 0x00c14 0x00c14 R E 0x10000
  LOAD           0x000c14 0x00020c14 0x00020c14 0x00154 0x0020c RW  0x10000
  DYNAMIC        0x000c24 0x00020c24 0x00020c24 0x000f8 0x000f8 RW  0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x10

 Section to Segment mapping:
  Segment Sections...
   00     .ARM.exidx
   01
   02     .interp
   03     .interp .hash .dynsym .dynstr .gnu.version .gnu.version_r
.rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.exidx .eh_frame
   04     .init_array .fini_array .jcr .dynamic .got .data .bss
   05     .dynamic
   06

Dynamic section at offset 0xc24 contains 26 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so]
 0x0000000c (INIT)                       0x106fc
 0x0000000d (FINI)                       0x10b68
 0x00000019 (INIT_ARRAY)                 0x20c14
 0x0000001b (INIT_ARRAYSZ)               8 (bytes)
 0x0000001a (FINI_ARRAY)                 0x20c1c
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x00000004 (HASH)                       0x1012c
 0x00000005 (STRTAB)                     0x103bc
 0x00000006 (SYMTAB)                     0x101ec
 0x0000000a (STRSZ)                      573 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x20d1c
 0x00000002 (PLTRELSZ)                   120 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x10684
 0x00000011 (REL)                        0x10674
 0x00000012 (RELSZ)                      16 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x10634
 0x6fffffff (VERNEEDNUM)                 1
 0x6ffffff0 (VERSYM)                     0x105fa
 0x00000000 (NULL)                       0x0




> > strace /lib/ld-musl-*.so.1 ./a.out
>

I don't have strace capability in my toolchain.



> > readelf -d /lib/libstdc++.so.6
>

Result
------------

Dynamic section at offset 0x126f00 contains 28 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libc.so]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x0000000e (SONAME)                     Library soname: [libstdc++.so.6]
 0x0000000c (INIT)                       0x68280
 0x0000000d (FINI)                       0x1100f8
 0x00000019 (INIT_ARRAY)                 0x1329ec
 0x0000001b (INIT_ARRAYSZ)               44 (bytes)
 0x0000001a (FINI_ARRAY)                 0x132a18
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x00000004 (HASH)                       0x114
 0x00000005 (STRTAB)                     0x1c8a8
 0x00000006 (SYMTAB)                     0x75c8
 0x0000000a (STRSZ)                      259844 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000003 (PLTGOT)                     0x137000
 0x00000002 (PLTRELSZ)                   6832 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x667d0
 0x00000011 (REL)                        0x5eef0
 0x00000012 (RELSZ)                      30944 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffc (VERDEF)                     0x5ea08
 0x6ffffffd (VERDEFNUM)                  34
 0x6ffffffe (VERNEED)                    0x5eeb0
 0x6fffffff (VERNEEDNUM)                 1
 0x6ffffff0 (VERSYM)                     0x5bfac
 0x6ffffffa (RELCOUNT)                   796
 0x00000000 (NULL)                       0x0




> > readelf -aW /lib/libstdc++.so.6 |grep Unwind
>

Result
------------

00137214  00036116 R_ARM_JUMP_SLOT        00000000   _Unwind_GetRegionStart
00137254  0003d116 R_ARM_JUMP_SLOT        00000000   _Unwind_GetTextRelBase
00137268  0003de16 R_ARM_JUMP_SLOT        00000000   _Unwind_RaiseException
00137330  00051c16 R_ARM_JUMP_SLOT        00000000
_Unwind_Resume_or_Rethrow
00137510  00083616 R_ARM_JUMP_SLOT        00000000
_Unwind_GetLanguageSpecificData
0013757c  0008d916 R_ARM_JUMP_SLOT        00000000   _Unwind_VRS_Get
001377f4  000d0016 R_ARM_JUMP_SLOT        00000000   _Unwind_Complete
00137954  000ee216 R_ARM_JUMP_SLOT        00000000   _Unwind_GetDataRelBase
00137b2c  0011f216 R_ARM_JUMP_SLOT        00000000   _Unwind_VRS_Set
00137bec  00131d16 R_ARM_JUMP_SLOT        00000000   _Unwind_DeleteException
00137c70  0013d416 R_ARM_JUMP_SLOT        00000000   _Unwind_Resume
Unwind table index '.ARM.exidx' at offset 0x11d9e4 contains 2164 entries:
0x6e11c <_ZL21base_of_encoded_valuehP15_Unwind_Context>: 0x80a8b0b0
0x6e190 <_ZL17parse_lsda_headerP15_Unwind_ContextPKhP16lsda_header_info>:
0x80acb0b0
0x6e990
<_ZL33__gxx_dependent_exception_cleanup19_Unwind_Reason_CodeP21_Unwind_Control_Block>:
0x80a8b0b0
0x6ee4c <_ZL22free_any_cxa_exceptionP21_Unwind_Control_Block>: 0x1
[cantunwind]
0x6f00c
<_ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP21_Unwind_Control_Block>:
0x80a8b0b0
   865: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_GetRegionStart@..._3.0 (36)
   977: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_GetTextRelBase@..._3.0 (36)
   990: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_RaiseException@..._3.0 (36)
  1308: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_Resume_or_Rethrow@..._3.3 (37)
  2102: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_GetLanguageSpecificData@..._3.0 (36)
  2265: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_VRS_Get@..._3.5
(35)
  3328: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_Complete@..._3.5
(35)
  3810: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_GetDataRelBase@..._3.0 (36)
  4594: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_VRS_Set@..._3.5
(35)
  4893: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_DeleteException@..._3.0 (36)
  5076: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_Resume@..._3.0
(36)
  4923: 0006e11c   116 FUNC    LOCAL  DEFAULT   11
_ZL21base_of_encoded_valuehP15_Unwind_Context
  4926: 0006e190   224 FUNC    LOCAL  DEFAULT   11
_ZL17parse_lsda_headerP15_Unwind_ContextPKhP16lsda_header_info
  4934: 0006e990   104 FUNC    LOCAL  DEFAULT   11
_ZL33__gxx_dependent_exception_cleanup19_Unwind_Reason_CodeP21_Unwind_Control_Block
  4995: 0006ee4c    84 FUNC    LOCAL  DEFAULT   11
_ZL22free_any_cxa_exceptionP21_Unwind_Control_Block
  5001: 0006f00c    96 FUNC    LOCAL  DEFAULT   11
_ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP21_Unwind_Control_Block
 13579: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetRegionStart@
@GCC_3.0
 13691: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetTextRelBase@
@GCC_3.0
 13704: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_RaiseException@
@GCC_3.0
 14022: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_Resume_or_Rethrow@@GCC_3.3
 14816: 00000000     0 FUNC    GLOBAL DEFAULT  UND
_Unwind_GetLanguageSpecificData@@GCC_3.0
 14979: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_VRS_Get@@GCC_3.5
 16042: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_Complete@@GCC_3.5
 16524: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetDataRelBase@
@GCC_3.0
 17308: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_VRS_Set@@GCC_3.5
 17607: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_DeleteException@
@GCC_3.0
 17790: 00000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_Resume@@GCC_3.0



> > readelf -aW /lib/libgcc_s.so.1 |grep Unwin
>

Result
------------

0002c1f0  0003a015 R_ARM_GLOB_DAT         00000000   __gnu_Unwind_Find_exidx
0002c108  00003016 R_ARM_JUMP_SLOT        0001b374   _Unwind_GetDataRelBase
0002c118  00007816 R_ARM_JUMP_SLOT        0001a2fc   _Unwind_VRS_Set
0002c128  00012e16 R_ARM_JUMP_SLOT        0001b350
_Unwind_GetLanguageSpecificData
0002c154  00028316 R_ARM_JUMP_SLOT        0001a900   _Unwind_VRS_Pop
0002c178  00035e16 R_ARM_JUMP_SLOT        0001b340   _Unwind_GetRegionStart
0002c17c  00038116 R_ARM_JUMP_SLOT        0001b36c   _Unwind_GetTextRelBase
0002c180  0003a016 R_ARM_JUMP_SLOT        00000000   __gnu_Unwind_Find_exidx
0002c198  00042616 R_ARM_JUMP_SLOT        0001a274   _Unwind_VRS_Get
Unwind table index '.ARM.exidx' at offset 0x1bd38 contains 34 entries:
0x19f00 <_Unwind_decode_typeinfo_ptr.isra.0>: 0x1 [cantunwind]
0x1a0f0 <_Unwind_GetCFA>: 0x1 [cantunwind]
0x1a0f8 <__gnu_Unwind_RaiseException>: 0x80383fab
0x1a1a0 <__gnu_Unwind_ForcedUnwind>: 0x1 [cantunwind]
0x1a1c4 <__gnu_Unwind_Resume>: 0x80aab0b0
0x1a238 <__gnu_Unwind_Resume_or_Rethrow>: 0x1 [cantunwind]
0x1a2d0 <_Unwind_GetGR>: 0x80048400
0x1a2fc <_Unwind_VRS_Set>: 0x1 [cantunwind]
0x1a358 <_Unwind_SetGR>: 0x80048400
0x1a384 <__gnu_Unwind_Backtrace>: 0x80b20dac
0x1a900 <_Unwind_VRS_Pop>: 0x80033fac
0x1aed4 <_Unwind_GetGR.constprop.1>: 0x80048400
0x1b340 <_Unwind_GetRegionStart>: 0x80a8b0b0
0x1b36c <_Unwind_GetTextRelBase.localalias.0>: 0x1 [cantunwind]
0x1b638 <_Unwind_SetGR>: 0x80048400
    48: 0001b374     4 FUNC    GLOBAL DEFAULT   10 _Unwind_GetDataRelBase@
@GCC_3.0
   120: 0001a2fc    92 FUNC    GLOBAL DEFAULT   10 _Unwind_VRS_Set@@GCC_3.5
   302: 0001b350    28 FUNC    GLOBAL DEFAULT   10
_Unwind_GetLanguageSpecificData@@GCC_3.0
   352: 0001a258     4 FUNC    GLOBAL DEFAULT   10 _Unwind_Complete@@GCC_3.5
   356: 0001a25c    24 FUNC    GLOBAL DEFAULT   10 _Unwind_DeleteException@
@GCC_3.0
   620: 0001ae04    36 FUNC    GLOBAL DEFAULT   10
_Unwind_Resume_or_Rethrow@@GCC_3.3
   643: 0001a900   968 FUNC    GLOBAL DEFAULT   10 _Unwind_VRS_Pop@@GCC_3.5
   719: 0001ae28    36 FUNC    GLOBAL DEFAULT   10 _Unwind_ForcedUnwind@
@GCC_3.0
   793: 0001adbc    36 FUNC    GLOBAL DEFAULT   10 _Unwind_RaiseException@
@GCC_3.0
   835: 0001ae4c    36 FUNC    GLOBAL DEFAULT   10 _Unwind_Backtrace@
@GCC_4.3.0
   862: 0001b340    16 FUNC    GLOBAL DEFAULT   10 _Unwind_GetRegionStart@
@GCC_3.0
   897: 0001b36c     8 FUNC    GLOBAL DEFAULT   10 _Unwind_GetTextRelBase@
@GCC_3.0
   915: 0001a0f0     8 FUNC    GLOBAL DEFAULT   10 _Unwind_GetCFA@@GCC_3.3
   928: 00000000     0 FUNC    WEAK   DEFAULT  UND __gnu_Unwind_Find_exidx
  1062: 0001a274    92 FUNC    GLOBAL DEFAULT   10 _Unwind_VRS_Get@@GCC_3.5
  1069: 0001ade0    36 FUNC    GLOBAL DEFAULT   10 _Unwind_Resume@@GCC_3.0
  1351: 00019f00    20 FUNC    LOCAL  DEFAULT   10
_Unwind_decode_typeinfo_ptr.isra.0
  1353: 00019f1c     4 FUNC    LOCAL  DEFAULT   10 _Unwind_DebugHook
  1356: 0001a2d0    44 FUNC    LOCAL  DEFAULT   10 _Unwind_GetGR
  1357: 0001a358    44 FUNC    LOCAL  DEFAULT   10 _Unwind_SetGR
  1365: 0001aed4    44 FUNC    LOCAL  DEFAULT   10 _Unwind_GetGR.constprop.1
  1367: 0001b36c     8 FUNC    LOCAL  DEFAULT   10
_Unwind_GetTextRelBase.localalias.0
  1376: 0001b638    44 FUNC    LOCAL  DEFAULT   10 _Unwind_SetGR
  1377: 0001b664    44 FUNC    LOCAL  DEFAULT   10 _Unwind_GetGR.constprop.0
  1421: 0001ad50     0 FUNC    LOCAL  DEFAULT   10 __gnu_Unwind_Save_WMMXD
  1423: 0001a238    32 FUNC    LOCAL  DEFAULT   10
__gnu_Unwind_Resume_or_Rethrow
  1427: 0001ae04    36 FUNC    LOCAL  DEFAULT   10
___Unwind_Resume_or_Rethrow
  1429: 0001ace4     0 FUNC    LOCAL  DEFAULT   10 __gnu_Unwind_Save_VFP
  1438: 0001acec     0 FUNC    LOCAL  DEFAULT   10
__gnu_Unwind_Restore_VFP_D
  1440: 0001a0f8   168 FUNC    LOCAL  DEFAULT   10
__gnu_Unwind_RaiseException
  1441: 0001acf4     0 FUNC    LOCAL  DEFAULT   10 __gnu_Unwind_Save_VFP_D
  1501: 0001ae4c    36 FUNC    LOCAL  DEFAULT   10 ___Unwind_Backtrace
  1508: 0001ad04     0 FUNC    LOCAL  DEFAULT   10
__gnu_Unwind_Save_VFP_D_16_to_31
  1513: 0001acfc     0 FUNC    LOCAL  DEFAULT   10
__gnu_Unwind_Restore_VFP_D_16_to_31
  1528: 0001ad0c     0 FUNC    LOCAL  DEFAULT   10
__gnu_Unwind_Restore_WMMXD
  1533: 0001ad94     0 FUNC    LOCAL  DEFAULT   10
__gnu_Unwind_Restore_WMMXC
  1539: 0001ae28    36 FUNC    LOCAL  DEFAULT   10 ___Unwind_ForcedUnwind
  1547: 0001adbc    36 FUNC    LOCAL  DEFAULT   10 ___Unwind_RaiseException
  1557: 0001a1a0    36 FUNC    LOCAL  DEFAULT   10 __gnu_Unwind_ForcedUnwind
  1559: 0001ade0    36 FUNC    LOCAL  DEFAULT   10 ___Unwind_Resume
  1569: 0001a1c4   116 FUNC    LOCAL  DEFAULT   10 __gnu_Unwind_Resume
  1574: 0001ada8     0 FUNC    LOCAL  DEFAULT   10 __gnu_Unwind_Save_WMMXC
  1589: 0001a384   200 FUNC    LOCAL  DEFAULT   10 __gnu_Unwind_Backtrace
  1590: 0001acdc     0 FUNC    LOCAL  DEFAULT   10 __gnu_Unwind_Restore_VFP
  1663: 0001b374     4 FUNC    GLOBAL DEFAULT   10 _Unwind_GetDataRelBase
  1735: 0001a2fc    92 FUNC    GLOBAL DEFAULT   10 _Unwind_VRS_Set
  1917: 0001b350    28 FUNC    GLOBAL DEFAULT   10
_Unwind_GetLanguageSpecificData
  1967: 0001a258     4 FUNC    GLOBAL DEFAULT   10 _Unwind_Complete
  1971: 0001a25c    24 FUNC    GLOBAL DEFAULT   10 _Unwind_DeleteException
  2235: 0001ae04    36 FUNC    GLOBAL DEFAULT   10 _Unwind_Resume_or_Rethrow
  2258: 0001a900   968 FUNC    GLOBAL DEFAULT   10 _Unwind_VRS_Pop
  2334: 0001ae28    36 FUNC    GLOBAL DEFAULT   10 _Unwind_ForcedUnwind
  2408: 0001adbc    36 FUNC    GLOBAL DEFAULT   10 _Unwind_RaiseException
  2450: 0001ae4c    36 FUNC    GLOBAL DEFAULT   10 _Unwind_Backtrace
  2477: 0001b340    16 FUNC    GLOBAL DEFAULT   10 _Unwind_GetRegionStart
  2512: 0001b36c     8 FUNC    GLOBAL DEFAULT   10 _Unwind_GetTextRelBase
  2530: 0001a0f0     8 FUNC    GLOBAL DEFAULT   10 _Unwind_GetCFA
  2543: 00000000     0 FUNC    WEAK   DEFAULT  UND __gnu_Unwind_Find_exidx
  2677: 0001a274    92 FUNC    GLOBAL DEFAULT   10 _Unwind_VRS_Get
  2684: 0001ade0    36 FUNC    GLOBAL DEFAULT   10 _Unwind_Resume



Thanks,

Content of type "text/html" skipped

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.