Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9921] Build settings for C/C++ symbol visibility #4729

Open
benlangmuir opened this issue Feb 14, 2019 · 1 comment
Open

[SR-9921] Build settings for C/C++ symbol visibility #4729

benlangmuir opened this issue Feb 14, 2019 · 1 comment

Comments

@benlangmuir
Copy link
Member

Previous ID SR-9921
Radar None
Original Reporter @benlangmuir
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: cffe6521be9d47ac2c5eda85d5d2434a

Issue Description:

In the C/C++ world, it is very common to enable `-fvisiblity=hidden` so that symbols are not exported unless they are explicitly marked up with `attribute((visibility("default")))`. This reduces code size, and more importantly prevents accidental use of internal symbols. When statically linking multiple C/C++ libraries into a single image, it is also useful to be able to remove the hidden symbols using ld -r to pre-link a static library into a single .o with only exported symbols visible.

The Swift Package Manager should support these workflows for C/C++ targets.

@benlangmuir
Copy link
Member Author

I think -fvisibility=hidden would be straightforward to add as a new target build setting that lowers to the appropriate compiler arguments, but it's unclear to me how to add a link step for ld -r.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants