RFR: 8329257: AIX: Switch HOTSPOT_TOOLCHAIN_TYPE from xlc to gcc [v3]

Magnus Ihse Bursie ihse at openjdk.org
Tue Apr 30 14:42:13 UTC 2024


On Tue, 30 Apr 2024 14:00:25 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> For the impatient, I suggest adopting mechanism 2, i.e. unconditionally
>> include <alloc.h> in globalDefinitions_gcc.hpp.
>> 
>> We can't include <alloca.h> in shared code, and there is a use in shared code
>> (in the relatively recently added JavaThread::pretouch_stack).
>> 
>> When I questioned whether we needed to include <alloca.h> at all, I referred
>> to a Linux man page I'd found on the internet (the same page mdoerr linked
>> to), which says (in part)
>> 
>> "By default, modern compilers automatically translate all uses of alloca()
>> into the built-in ..."
>> 
>> Apparently I should have kept digging, because it seems that page is
>> old/incorrect. A seemingly more recent Linux man page describes a different
>> way of handling it that is closer to what we're seeing, but still not quite
>> correct.
>> 
>> glibc's <stdlib.h> includes <alloca.h> if __USE_MISC is defined.
>> One of the ways __USE_MISC can become defined is if _GNU_SOURCE is defined,
>> and we define that for both gcc and clang toolchains.
>> 
>> We include <stdlib.h> in globalDefinitions_gcc.hpp. So when building with gcc,
>> globalDefinitions.hpp implicitly includes <alloca.h>.
>> 
>> The glibc definition of alloca is
>> 
>> #ifdef	__GNUC__
>> # define alloca(size)	__builtin_alloca (size)
>> #endif /* GCC.  */
>> 
>> So that explains why we don't need any explicit include of <alloca.h> when
>> building with gcc.  I expect there's something similar going on with Visual
>> Studio and Xcode/clang.  But apparently not with Open XLC clang.
>
> Ok for me. Let's hear what @kimbarrett thinks.

It might be easier to get input if you create a new PR with the change. This discussion is hidden deep down in a closed PR.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18536#discussion_r1584947979


More information about the build-dev mailing list