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

Share compiler configurations across libs & coreclr #58096

Merged

Conversation

am11
Copy link
Member

@am11 am11 commented Aug 25, 2021

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.

@dotnet-issue-labeler
Copy link

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.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Aug 25, 2021
@am11 am11 force-pushed the feature/consolidations/configure-compiler branch 5 times, most recently from 308a039 to d3ec569 Compare August 25, 2021 12:08
@am11 am11 marked this pull request as ready for review August 25, 2021 12:09
@am11 am11 force-pushed the feature/consolidations/configure-compiler branch from e552c78 to 2ceaa4b Compare August 25, 2021 17:37
@am11
Copy link
Member Author

am11 commented Aug 25, 2021

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! 👍

Copy link
Member

@jkoritzinsky jkoritzinsky left a 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

src/coreclr/vm/encee.cpp Show resolved Hide resolved
@@ -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)
Copy link
Member

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.

Copy link
Member Author

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:

# Unconditionally define _FILE_OFFSET_BITS as 64 on all platforms.
add_definitions(-D_FILE_OFFSET_BITS=64)

Copy link
Member

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.

Copy link
Member Author

@am11 am11 Sep 22, 2021

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..

Copy link
Member Author

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.

Copy link
Member

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'

Copy link
Member Author

@am11 am11 Sep 22, 2021

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! :)

@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants