-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Share compiler configurations across libs & coreclr #58096
Share compiler configurations across libs & coreclr #58096
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
308a039
to
d3ec569
Compare
e552c78
to
2ceaa4b
Compare
Windows x86 test failure is unrelated: #57626. cc @jkotas, @lambdageek, @jkoritzinsky, @janvorli, please take a look (perhaps best review without the whitespace changes as some if/else blocks are outdented by removal of their parent conditions: https://github.com/dotnet/runtime/pull/58096/files?w=1). Thanks! 👍 |
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.
LGTM with one comment
@@ -76,7 +76,6 @@ endif(FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) | |||
add_definitions(-DLP64COMPATIBLE) | |||
add_definitions(-DCORECLR) | |||
add_definitions(-DPIC) | |||
add_definitions(-D_FILE_OFFSET_BITS=64) |
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.
@am11 why have you removed this line and the same one in the configure.cmake and inb the hosts CMakeLists? It is not correct, we want to support 64 bit file offsets on all platforms. The PAL tests on ARM are now failing due to this (see #58481). I don't see this removal mentioned in the PR description. I have not noticed this before, I was OOF when this PR was created and merged.
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.
@janvorli, it was moved at common place:
runtime/eng/native/configurecompiler.cmake
Lines 280 to 281 in 5181e1c
# Unconditionally define _FILE_OFFSET_BITS as 64 on all platforms. | |
add_definitions(-D_FILE_OFFSET_BITS=64) |
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.
But that doesn't influence the compiler options in the configure.cmake. So while this place and the hosts are likely ok, the configure.cmake change causes the problem, as we detect off_t as 4 bytes due to the missing define.
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.
I think you can double-check, but I am pretty sure global defines are used in cmake introspection unless explicitly stripped off.
Besides, #58481 was opened ~11 hours before this PR was merged..
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.
Ah I mixed up; was checking on mobile, but it does seem like first occurrence of File sizes do not match up.
happened after this was merged. The one on 24th of August is different error Call to SetEndOfFile failed with 112
. Will check it out shortly.
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.
I've just verified that adding that line back to configure.cmake fixes the failing tests (I've tried without it to eliminate the possibility that something else is in play here). And the global defines are really not used in the introspection, I've checked the CMakeOutput.txt and the only definitions passed to the compiler were the ones in the CMAKE_REQUIRED_DEFINITIONS:
Run Build Command(s):/usr/bin/make cmTC_087a6/fast && /usr/bin/make -f CMakeFiles/cmTC_087a6.dir/build.make CMakeFiles/cmTC_087a6.dir/build
make[1]: Entering directory '/home/janvorli/git/runtime/artifacts/obj/coreclr/Linux.arm.Debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_087a6.dir/SIZEOF_OFF_T.c.o
/usr/bin/clang-9 -fPIE -D_BSD_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -o CMakeFiles/cmTC_087a6.dir/SIZEOF_OFF_T.c.o -c /home/janvorli/git/runtime/artifacts/obj/coreclr/Linux.arm.Debug/CMakeFiles/CheckTypeSize/SIZEOF_OFF_T.c
Linking C executable cmTC_087a6
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_087a6.dir/link.txt --verbose=1
/usr/bin/clang-9 -pie -Wl,--build-id=sha1 -Wl,-z,relro,-z,now CMakeFiles/cmTC_087a6.dir/SIZEOF_OFF_T.c.o -o cmTC_087a6
make[1]: Leaving directory '/home/janvorli/git/runtime/artifacts/obj/coreclr/Linux.arm.Debug/CMakeFiles/CMakeTmp'
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.
Absolutely, we set CMAKE_REQUIRED_DEFINITIONS
so whatever it had before is reset. #59504 for the fix. Thanks for spotting it! :)
During the single repo consolidation, we postponed consolidation of libs.native compiler configurations (settings, suppression etc.), due to the Mono/Xamarin platforms onboarding at the time. The libs.native subset only took advantage of shared native tools and platforms configurations.
Now that the platform matrix is stable enough (compared to last year), this PR consolidates compiler configurations such that System.Native/Unix, coreclr and corehost use the same baseline configurations defined in
eng/native/configurecompiler.cmake
.Additionally, during the testing I included gcc11 in my local matrix and mainly suppressed the reported warnings (that show up as errors) for now.