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

build: no need for -fpic #1193

Merged
merged 1 commit into from
May 29, 2023
Merged

build: no need for -fpic #1193

merged 1 commit into from
May 29, 2023

Conversation

yperbasis
Copy link
Member

@yperbasis yperbasis commented May 28, 2023

Position independent code is required for shared libraries, which we don't use. Moreover, cmake sets pic to true automatically for shared libs.

@yperbasis yperbasis marked this pull request as ready for review May 29, 2023 08:35
Copy link
Member

@chfast chfast left a comment

Choose a reason for hiding this comment

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

There is a bit more to this. You can also produce Position Independent Executable (PIE) although I'm not sure if CMake supports it directly. The PIE enhances address space layout randomization (ASLR).

To the point: some compilers (e.g. GCC on Debian) are configured to use PIC/PIE by default. Then you need to disable it manually (e.g. -no-pie, -fno-PIC).

But the change itself is good.

@yperbasis yperbasis merged commit 540a91d into master May 29, 2023
@yperbasis yperbasis deleted the ci/no_pic branch May 29, 2023 08:56
@yperbasis yperbasis added the maintenance Some maintenance work (fix, refactor, rename, test...) label May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Some maintenance work (fix, refactor, rename, test...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants