Skip to content

[SR-1021] Don't export public symbols from static libraries by default #43633

@jckarter

Description

@jckarter
Previous ID SR-1021
Radar None
Original Reporter @jckarter
Type Bug
Additional Detail from JIRA
Votes 3
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 8df16971f82bdca1788af1569c947c46

relates to:

  • SR-521 Public symbols are never dead stripped

Issue Description:

When we statically link Swift libraries into executables, the public symbols from those libraries should not be exported from the result executable. This can be done at link time by passing --exclude-libs to GNU ld (I couldn't find an equivalent flag for ld64 at a glance), or we could do it at compile time by only emitting symbols with hidden visibility when we know we're building for a static library.

When we link static libraries into a dynamic library, it's a more interesting policy decision whether those libraries' symbols should be exported by the dynamic library. IMO we shouldn't by default, unless the dynamic library module explicitly reexports APIs from its static dependencies as its own public API. This would definitely require compiler support, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions