-
Notifications
You must be signed in to change notification settings - Fork 708
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: add s2n_prelude.h to consolidate defines #4465
Conversation
e7e88ff
to
1c586b2
Compare
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
bda4405
to
4e2083d
Compare
4e2083d
to
ba9cd03
Compare
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
51411b8
to
177519e
Compare
target_compile_options(${PROJECT_NAME} PUBLIC -fPIC -include "${CMAKE_CURRENT_LIST_DIR}/utils/s2n_prelude.h") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if we accidentally remove this "include"? Does it fail loudly?
And as discussed offline, maybe an assert or a test would give a nice clear failure.
@@ -192,11 +192,12 @@ if(S2N_BLOCK_NONPORTABLE_OPTIMIZATIONS) | |||
target_compile_options(${PROJECT_NAME} PUBLIC -DS2N_BLOCK_NONPORTABLE_OPTIMIZATIONS=1) | |||
endif() | |||
|
|||
target_compile_options(${PROJECT_NAME} PUBLIC -fPIC) | |||
target_compile_options(${PROJECT_NAME} PUBLIC -fPIC -include "${CMAKE_CURRENT_LIST_DIR}/utils/s2n_prelude.h") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be like this:
target_compile_options(${PROJECT_NAME} PUBLIC -fPIC -include "${CMAKE_CURRENT_LIST_DIR}/utils/s2n_prelude.h") | |
target_compile_options(${PROJECT_NAME} PUBLIC -fPIC) | |
target_compile_options(${PROJECT_NAME} PRIVATE -include "${CMAKE_CURRENT_LIST_DIR}/utils/s2n_prelude.h") |
By making this PUBLIC, any project that depends, directly or indirectly, on S2N gets this compile option added to all their .c/.cpp files
Description of changes:
This change adds a
s2n_prelude.h
that is included as part of every file on compilation. This aims to simplify/consolidate the project-wide defines, includingS2N_API
,_POSIX_C_SOURCE
,_GNU_SOURCE
, and_FORTIFY_SOURCE
.Call-outs:
I fixed a few related issues as part of this change
s2n_fork_detection.c
. This caused a mismatch in behavior on OpenBSD. To make this easier to maintain, I moved all of the include/setup intos2n_fork_detection_internal.h
.s2n-tls-sys
rust crate, we were keying onPROFILE == release
instead ofOPT_LEVEL > 0
to enable fortify source. As noted in the cargo documention, OPT_LEVEL is more correct, since workspaces can create different profiles outside ofrelease
.Testing:
Since this is a build change, all of the existing tests show it working as expected.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.