-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
b856355
to
01be68f
Compare
Many thanks! If this progresses all the way to CoreFX and CoreSetup, it would really help Solaris/SmartOS ports, where the main blocker is lack of full LLVM toolchain support (case in point missing LLDB, while Clang6 and LLVM6 were recently ported via pkgsrc). However, GCC is readily available. |
We can start building on top once this goes in. Everybody has different interests for this project. GCC is the common denominator for me too. |
@dotnet-bot test OSX10.12 x64 Checked Innerloop Build and Test |
MSVC and GNU compilers use different attributes for noinline. Abstract away compiler differences.
__cdecl is not defined by default on GNU compilers.
__sync_swap doesn't exist on GNU. Replacing with __atomic_exchange_n which is universally available.
A pointer value is usually unsigned long on most platforms. Casting it to integer causes signedness issues. Use size_t to be efficient on all 32 and 64 bit architectures.
Correct error statement. GNU G++ is picky about the string following the error statement with ' character in it. It needs to be enclosed with double quotes.
Seeing these warnings with GNU G++ compiler src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalInitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION, DWORD, bool)’: src/pal/src/sync/cs.cpp:630:48: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalLeaveCriticalSection(CorUnix::CPalThread*, _CRITICAL_SECTION*)’: src/pal/src/sync/cs.cpp:880:43: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^
b216d7b
to
6befc40
Compare
I'm confused. Are these two failures caused by my change or did they exist already? I reduced the changeset to a single commit and it still happens. |
They look unrelated to your commit. I have seen elevated error rates on these two builds for the past few days. In most cases they look like infrastructure errors when the process is aborted due to timeout. However in this case the OS X build had some error I have not seen before. @dotnet-bot test CentOS7.1 x64 Debug Innerloop Build |
@dotnet-bot test coreclr-ci please |
ok, this looks better after retries. I'll push the rest now. |
let me see if this retry command works. @dotnet-bot test Ubuntu x64 Checked Innerloop Build and Test (Jit - TieredCompilation=0) |
Don't worry about the coreclr-ci, it currently seems to never succeed in any PR. |
Anything else on this PR? |
857d178
to
e1a34ee
Compare
What is the recommended review policy for this change? My initial plan was to do this piecemeal meaning get the PAL layer in and then do follow up with incremental patches. It looks like this patchset is growing as I started to compile other code outside of PAL now. |
It depends on how much you'll end up changing. If you expect just a few remaining things to fix, then it would make sense to have it all in one change. But if you think there is still a lot changes needed, then let's do it in smaller chunks. |
GNU compiler doesn't support optnone attribute. pal/src/exception/seh-unwind.cpp:449:77: warning: ‘optnone’ attribute directive ignored [-Wattributes]
I see the current state as coherent enough to be checked in. It allows PAL layered to be compiled with GCC without a single line of change assuming all builds pass. I'm sure there will be other changes in other directories but I think we have to handle them separately in order not to lose the context. |
e1a34ee
to
313d74a
Compare
GNU compiler doesn't have an intrinsic for these. Open code them using the provided implementation.
/usr/include/string.h:43:28: error: declaration of ‘void* memcpy(void*, const void*, size_t) throw ()’ has a different exception specifier size_t __n) __THROW __nonnull ((1, 2));
313d74a
to
657f85b
Compare
Time to check-in? Any other review comments? |
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, thank you!
After the Linux-musl CI leg completes, we can merge it in |
Is this something I need to run? |
No, these were the ci legs that were running automatically for your changes. Now all the legs have passed, so I am merging it in. |
Thank you! |
1.st follow up posted here: #22369 |
This contains a grab bag of fixes to fix the build with clang 10. - dotnet#23075 Fix missing includes in coreclr/src/debug/createdump/ - dotnet/runtime#33096 SList::Init: add missing constructor - A subset of dotnet#22129 Just the parts that introduce the THROW_DECL macro in pal.h - dotnet/runtime#32837 This fixes THROW_DECL introduce in the previous PR to work with clang, which is required in clang 10. - One new change: In a significant divergance, this commits adds more THROW_DECL macros to all the math functions to address a ton of errors pointed out when building SOS: In file included from /home/omajid/devel/dotnet/coreclr/src/ToolBox/SOS/Strike/strike.cpp:116: In file included from /home/omajid/devel/dotnet/coreclr/src/vm/hillclimbing.h:19: In file included from /home/omajid/devel/dotnet/coreclr/src/inc/complex.h:16: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/math.h:36: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cmath:45: In file included from /usr/include/math.h:290: /usr/include/bits/mathcalls.h:53:13: error: exception specification in declaration does not match previous declaration __MATHCALL (acos,, (_Mdouble_ __x)); ^ /home/omajid/devel/dotnet/coreclr/src/pal/inc/pal.h:4395:26: note: previous declaration is here PALIMPORT double __cdecl acos(double); ^ Then, to make sure the declarations and implementations match, it adds THROW_DECL to the definitions in src/pal/src/cruntime/math.cpp
This contains a grab bag of fixes to fix the build with clang 10. - dotnet#23075 Fix missing includes in coreclr/src/debug/createdump/ - dotnet/runtime#33096 SList::Init: add missing constructor - A subset of dotnet#22129 Just the parts that introduce the THROW_DECL macro in pal.h - dotnet/runtime#32837 This fixes THROW_DECL introduce in the previous PR to work with clang, which is required in clang 10. - One new change: In a significant divergance, this commits adds more THROW_DECL macros to all the math functions to address a ton of errors pointed out when building SOS: In file included from /home/omajid/devel/dotnet/coreclr/src/ToolBox/SOS/Strike/strike.cpp:116: In file included from /home/omajid/devel/dotnet/coreclr/src/vm/hillclimbing.h:19: In file included from /home/omajid/devel/dotnet/coreclr/src/inc/complex.h:16: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/math.h:36: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cmath:45: In file included from /usr/include/math.h:290: /usr/include/bits/mathcalls.h:53:13: error: exception specification in declaration does not match previous declaration __MATHCALL (acos,, (_Mdouble_ __x)); ^ /home/omajid/devel/dotnet/coreclr/src/pal/inc/pal.h:4395:26: note: previous declaration is here PALIMPORT double __cdecl acos(double); ^ Then, to make sure the declarations and implementations match, it adds THROW_DECL to the definitions in src/pal/src/cruntime/math.cpp Co-authored-by: Mike McLaughlin <mikem@microsoft.com> Co-authored-by: Sinan Kaya <sinan.kaya@microsoft.com> Co-authored-by: Tom Deseyn <tom.deseyn@gmail.com>
This contains a grab bag of fixes to fix the build with clang 10. - #23075 Fix missing includes in coreclr/src/debug/createdump/ - dotnet/runtime#33096 SList::Init: add missing constructor - A subset of #22129 Just the parts that introduce the THROW_DECL macro in pal.h - dotnet/runtime#32837 This fixes THROW_DECL introduce in the previous PR to work with clang, which is required in clang 10. - One new change: In a significant divergance, this commits adds more THROW_DECL macros to all the math functions to address a ton of errors pointed out when building SOS: In file included from /home/omajid/devel/dotnet/coreclr/src/ToolBox/SOS/Strike/strike.cpp:116: In file included from /home/omajid/devel/dotnet/coreclr/src/vm/hillclimbing.h:19: In file included from /home/omajid/devel/dotnet/coreclr/src/inc/complex.h:16: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/math.h:36: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cmath:45: In file included from /usr/include/math.h:290: /usr/include/bits/mathcalls.h:53:13: error: exception specification in declaration does not match previous declaration __MATHCALL (acos,, (_Mdouble_ __x)); ^ /home/omajid/devel/dotnet/coreclr/src/pal/inc/pal.h:4395:26: note: previous declaration is here PALIMPORT double __cdecl acos(double); ^ Then, to make sure the declarations and implementations match, it adds THROW_DECL to the definitions in src/pal/src/cruntime/math.cpp Co-authored-by: Mike McLaughlin <mikem@microsoft.com> Co-authored-by: Sinan Kaya <sinan.kaya@microsoft.com> Co-authored-by: Tom Deseyn <tom.deseyn@gmail.com> Co-authored-by: Mike McLaughlin <mikem@microsoft.com> Co-authored-by: Sinan Kaya <sinan.kaya@microsoft.com> Co-authored-by: Tom Deseyn <tom.deseyn@gmail.com>
* Abstract away NOINLINE statement MSVC and GNU compilers use different attributes for noinline. Abstract away compiler differences. * Replace __sync_swap with __atomic_exchange_n __sync_swap doesn't exist on GNU. Replacing with __atomic_exchange_n which is universally available. * Define CDECL for GNUC __cdecl is not defined by default on GNU compilers. * Define gcc version of __declspec(thread) * Correct pointer casting A pointer value is usually unsigned long on most platforms. Casting it to integer causes signedness issues. Use size_t to be efficient on all 32 and 64 bit architectures. * Put quotes around the error string Correct error statement. GNU G++ is picky about the string following the error statement with ' character in it. It needs to be enclosed with double quotes. * Fix casting problem Seeing these warnings with GNU G++ compiler src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalInitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION, DWORD, bool)’: src/pal/src/sync/cs.cpp:630:48: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalLeaveCriticalSection(CorUnix::CPalThread*, _CRITICAL_SECTION*)’: src/pal/src/sync/cs.cpp:880:43: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ * Abstract optnone compiler attribute GNU compiler doesn't support optnone attribute. pal/src/exception/seh-unwind.cpp:449:77: warning: ‘optnone’ attribute directive ignored [-Wattributes] * Set the aligned attribute for GNU compiler * Make __rotl and __rotr functions portable GNU compiler doesn't have an intrinsic for these. Open code them using the provided implementation. * Define deprecated attribute for gcc * Add throw specifier for GCC /usr/include/string.h:43:28: error: declaration of ‘void* memcpy(void*, const void*, size_t) throw ()’ has a different exception specifier size_t __n) __THROW __nonnull ((1, 2)); Commit migrated from dotnet/coreclr@fc7a8fb
This is an attempt to port PAL layer to GNU compiler. The rest will follow later.