Closed
Description
Previous ID | SR-8897 |
Radar | None |
Original Reporter | @kevints |
Type | Bug |
Status | Resolved |
Resolution | Done |
Environment
Swift 4.2-RELEASE
Ubuntu 14.04
Additional Detail from JIRA
Votes | 0 |
Component/s | libdispatch |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: d0ae55b32dda9f738148fca4ddf298c6
Issue Description:
the libdispatch shared library shipped with swift-4.2-RELEASE references symbols defined by the swift runtime, for example:
root@1c33bbf3ea71:/code/build/Ninja-DebugAssert/libdispatch-linux-x86_64# readelf -W --dyn-syms /code/swift-4.2-RELEASE-ubuntu14.04/usr/lib/swift/linux/libdispatch.so | grep -E '(swift_alloc)'
246: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND swift_allocObject
247: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND swift_allocateGenericClassMetadata
However, it does not link to the swift runtime (we'd expect a NEEDED: libswiftCore.so) in this list:
$ readelf -d /code/swift-4.2-RELEASE-ubuntu14.04/usr/lib/swift/linux/libdispatch.so
Dynamic section at offset 0x8baf0 contains 33 entries:
Tag Type Name/Value
0x0000000000000003 (PLTGOT) 0x8cfe8
0x0000000000000002 (PLTRELSZ) 5976 (bytes)
0x0000000000000017 (JMPREL) 0x31110
0x0000000000000014 (PLTREL) RELA
0x0000000000000007 (RELA) 0x12798
0x0000000000000008 (RELASZ) 125304 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffff9 (RELACOUNT) 5011
0x0000000000000006 (SYMTAB) 0x200
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000005 (STRTAB) 0x6680
0x000000000000000a (STRSZ) 40672 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x10560
0x0000000000000001 (NEEDED) Shared library: [libbsd.so.0]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [ld-linux-x86-64.so.2]
0x000000000000000e (SONAME) Library soname: [libdispatch.so]
0x000000000000000c (INIT) 0x32868
0x000000000000000d (FINI) 0x60804
0x000000000000001a (FINI_ARRAY) 0x71348
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x0000000000000019 (INIT_ARRAY) 0x71350
0x000000000000001b (INIT_ARRAYSZ) 16 (bytes)
0x000000006ffffff0 (VERSYM) 0x11de8
0x000000006ffffffc (VERDEF) 0x12648
0x000000006ffffffd (VERDEFNUM) 1
0x000000006ffffffe (VERNEED) 0x12664
0x000000006fffffff (VERNEEDNUM) 5
0x0000000000000000 (NULL) 0x0
This seems to be related to the structure of the dispatch build system. It uses the host C++ compiler to link libdispatch, rather than swiftc -emit-library [1] and as such omits swiftCore (and swiftOnoneSupport in debug builds).
[1] https://github.com/apple/swift-corelibs-libdispatch/blob/swift-4.2-RELEASE/src/CMakeLists.txt#L95