Skip to content

[SR-1901] Linker error "hidden symbol" on subclassing Thread #4133

@aciidgh

Description

@aciidgh
Previous ID SR-1901
Radar None
Original Reporter @aciidb0mb3r
Type Bug
Status Resolved
Resolution Done
Environment

Linux

Additional Detail from JIRA
Votes 1
Component/s Foundation, XCTest
Labels Bug
Assignee @eeckstein
Priority Medium

md5: b317e664abb519336896529a6617e8d9

relates to:

  • SR-1129 Linker step fails when subclassing a class with a 'public private(set) var'
  • SR-2170 Linux Linker error when deriving a class from NSURL

Issue Description:

This code produces a linker error on Linux:

import class Foundation.Thread

class Thread: Foundation.Thread {
}
$ swiftc Thread.swift
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threadg5_mainFT_T_' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threads5_mainFT_T_' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threadm5_mainFT_T_' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6ThreadgP33_513815EE0AA0753AFF631398622CF9397_threadSu' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6ThreadsP33_513815EE0AA0753AFF631398622CF9397_threadSu' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6ThreadmP33_513815EE0AA0753AFF631398622CF9397_threadSu' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threadg5_attrVSC14pthread_attr_t' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threads5_attrVSC14pthread_attr_t' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threadm5_attrVSC14pthread_attr_t' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threadg7_statusOS_15_NSThreadStatus' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threads7_statusOS_15_NSThreadStatus' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threadm7_statusOS_15_NSThreadStatus' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threadg10_cancelledSb' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threads10_cancelledSb' is not defined locally
/usr/bin/ld.gold: error: hidden symbol '_TFC10Foundation6Threadm10_cancelledSb' is not defined locally
clang: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)

However no error if ran as a script:
$ swift Thread.swift
<no error>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions