<div dir="ltr">forwarded to other teams for review.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 13, 2019 at 3:14 AM Patrick Zhang OS <<a href="mailto:patrick@os.amperecomputing.com">patrick@os.amperecomputing.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi <br>
<br>
Please review this patch, if it should be reviewed by any group other than core-libs, please help forward it. Thanks.<br>
<br>
JBS: <a href="https://bugs.openjdk.java.net/browse/JDK-8235903" rel="noreferrer" target="_blank">https://bugs.openjdk.java.net/browse/JDK-8235903</a> <br>
Webrev: <a href="http://cr.openjdk.java.net/~qpzhang/8235903/webrev.01/" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~qpzhang/8235903/webrev.01/</a><br>
<br>
A recent GCC patch (supposed to be in GCC 10) exposes a couple of "multiple definition" link errors when building the jdk tip.<br>
<br>
[PATCH] PR85678: Change default to -fno-common<br>
<a href="https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01847.html" rel="noreferrer" target="_blank">https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01847.html</a> <br>
<br>
For example, the error message looks like:<br>
* For target support_native_java.base_libjava_BUILD_LIBJAVA_link:<br>
build/support/native/java.base/libjava/childproc.o:(.bss+0x0): multiple definition of `parentPathv'<br>
build/support/native/java.base/libjava/ProcessImpl_md.o:(.bss+0x0): first defined here<br>
collect2: error: ld returned 1 exit status<br>
<br>
This was not an issue because the original default -fcommon allowed "global variables defined without an initializer" be handled as COMMON symbols, so it would not warn the problem like "same variable is accidentally defined in more than one compilation unit".<br>
<br>
About -fcommon vs -fno-cmmon:<br>
<a href="https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-common" rel="noreferrer" target="_blank">https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-common</a> <br>
<br>
Moving forward, building jdk with latest versions of GCC will trigger this error. Specifying "--with-extra-cflags='-fcommon'" can make it work, but it just got things hidden again.<br>
<br>
In addition, -fcommon's behavior "is inconsistent with C++, and on many targets implies a speed and code size penalty on global variable references. It is mainly useful to enable legacy code to link without errors."<br>
<br>
Last, in case that other jdk developers would revisit this problem once again, I suggest fixing the error explicitly instead of using "-fcommon"<br>
<br>
Regards<br>
Patrick<br>
<br>
</blockquote></div>