Skip to content

[native_toolchain_c] Explicitly tell linker to create position dependent or position independent executable #139

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 5 commits into from
Sep 16, 2023

Conversation

blaugold
Copy link
Contributor

@blaugold blaugold commented Sep 15, 2023

I assumed that -fPIE also affect the linking stage. This is not the case. It only affects code generation. Whether a position dependent or independent executable is generated depends on the -pie and -no-pie options. Compilers and compiler versions can have different defaults for creating position dependent or independent executables (apparently clang changed its default somewhere between 16 and 18). With this PR, we now pass -pie and -no-pie in addition to -fPIE/-fno-PIE, when compiling an executable.

@coveralls
Copy link

coveralls commented Sep 15, 2023

Coverage Status

coverage: 98.172%. remained the same when pulling 195fca7 on blaugold:fix-pic into 3c81311 on dart-lang:main.

@blaugold blaugold changed the title Fix #133 Explicitly tell linker to create position dependent or position independent executable Sep 15, 2023
@blaugold blaugold marked this pull request as ready for review September 15, 2023 20:08
@blaugold blaugold changed the title Explicitly tell linker to create position dependent or position independent executable [native_toolchain_c] Explicitly tell linker to create position dependent or position independent executable Sep 15, 2023
Copy link
Collaborator

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

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

Thanks @blaugold !

@dcharkes dcharkes merged commit 13b1a56 into dart-lang:main Sep 16, 2023
HosseinYousefi pushed a commit that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants