Skip to content

Fix LD_EXPORT_GLOBAL_SYMBOLS when using swiftc as the linker driver #400

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

Merged
merged 1 commit into from
Apr 10, 2025

Conversation

owenv
Copy link
Collaborator

@owenv owenv commented Apr 10, 2025

#395

Closes: #395

@owenv
Copy link
Collaborator Author

owenv commented Apr 10, 2025

@swift-ci test

@jakepetroules
Copy link
Collaborator

Gentle reminder that if this is meant to close #395, the PR description should say Closes: #395 so GitHub hooks those up.

@owenv owenv merged commit f13ab5a into main Apr 10, 2025
3 checks passed
@owenv owenv deleted the owenv/export-dynamic branch April 10, 2025 23:32
Condition = "$(LINKER_DRIVER) == swiftc";
CommandLineArgs = {
YES = (
"-Xlinker", "--export-dynamic"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use -Xclang-linker -rdynamic instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-rdynamic isn't available at all on Linux.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clang driver accepts -rdynamic everywhere. I generally agree we should be using -Xclang-linker in more places and delegate platform differences to the driver. Will put up a PR in a bit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dschaefer2 -rdynamic is a platform agnostic spelling, can you help me understand why you believe it is unavailable on Linux?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following on Linux

warning: unknown Argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument] []

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is expected! during compilation is the operative portion of the message. This flag has no impact on compilation, it is a link time flag only. This is why -Xclang-linker is used rather than -Xcc. This flag is to be passed to the linker driver (clang).

@dschaefer2
Copy link
Member

The question I had, is the behaviour -rdynamic provided not required on Linux?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unrecognized '-rdynamic' flag when using swiftc linker driver
5 participants