-
Notifications
You must be signed in to change notification settings - Fork 728
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
Update Linux makefile to allow compilation with GCC 7.3 #1921
Conversation
GCC versions greater than 5 default to GNU11 but OpenJ9 uses GNU89 inline semantics. -fgnu89-inline option is appended to CFLAGS to allow compilation with GCC versions greater than 5 and GNU89 inline semantics. Reference - https://gcc.gnu.org/gcc-5/porting_to.html. JDK11 Linux x86 DockerFile no longer needs to initialize CFLAGS with -fgnu89-inline since the Linux makefile now accounts for -fgnu89-inline option if the GCC version is greater than 5. Signed-off-by: Babneet Singh <[email protected]>
Compilation passes on xLinux, pLinux and zLinux with gcc-4.8. Compilation passes on xLinux with gcc-7.3. Compile failures related to OpenJDK source code seen when compiling on pLinux with gcc-7.3. No zLinux machine available to compile with gcc-7.3. |
This pull request solves the For using this approach, I would like to request approval from JIT members: @mpirvu, @fjeremic, @andrewcraik since JIT source code is impacted by the compile error. |
fyi - @pshipton |
to allow compilation with GCC versions greater than 5 and GNU89 inline | ||
semantics. Reference - https://gcc.gnu.org/gcc-5/porting_to.html. | ||
--> | ||
GCCVERSIONGTEQ5 := $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 5) |
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 when gcc 10 ships? (Not a blocker for merging this now but something to think about while we're looking at this or we'll have to rediscover it later)
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.
gcc -dumpversion | cut -f1 -d.
will evaluate to10
expr 10 \>= 5
will evaluate to1
GCCVERSIONGTEQ5
=1
if GCCVERSIONGTEQ5 == 1
thenCFLAGS+=-fgnu89-inline
We want to use -fgnu89-inline
for GCC versions >= 5 since they will default to GNU11 semantics.
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 misread the cut
command.
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.
We should not be invoking gcc
, but instead checking if we're using the gcc toolchain and only then invoking $(CC) -dumpversion
. A system has at most one tool called 'gcc', but the user may have configured their build to use a different version; the test should be based on the selected compiler.
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'll put together a PR to address my previous comment.
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.
Good catch. Thanks @keithc-ca
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.
Thanks @keithc-ca
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.
#2205 proposes a fix for this.
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
Jenkins test sanity xlinux |
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
GCC versions greater than 5 default to GNU11 but OpenJ9 uses
GNU89 inline semantics. -fgnu89-inline option is appended to CFLAGS
to allow compilation with GCC versions greater than 5 and GNU89 inline
semantics. Reference - https://gcc.gnu.org/gcc-5/porting_to.html.
JDK11 Linux x86 DockerFile no longer needs to initialize CFLAGS with
-fgnu89-inline since the Linux makefile now accounts for -fgnu89-inline
option if the GCC version is greater than 5.
Signed-off-by: Babneet Singh [email protected]