RFR: JDK-8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
Erik Joelsson
erik.joelsson at oracle.com
Fri Apr 5 15:09:44 UTC 2019
Hello,
On 2019-04-05 06:56, Erik Joelsson wrote:
>
> On 2019-04-04 22:23, Ioi Lam wrote:
>>
>>
>> I am sure the build system is correct ..... but it's complicated.
>>
>> BTW, we actually have generated sources that can live outside of the
>> source repo. And with luck, their names can actually be shorter than
>> FILE_MACRO_OFFSET.
>>
> That is a very good point, completely forgot about that case. I
> retract my current proposal.
>
I took a look at the currently generated files, and none of the objects
created from those files currently contain any __FILE__ references. Even
so, I still agree that we cannot simply use a general offset as I
proposed. Instead, I have taken Kim's proposal and implemented THIS_FILE
using the this_file_helper inline function he posted.
New webrev: http://cr.openjdk.java.net/~erikj/8221851/webrev.03/
Not being very familiar with the Hotspot code base, I'm quite at a loss
as to where to put this. I picked globalDefinitions.hpp, but please help
direct me to the right place. Also, I'm not sure wrapping the inline
function in a macro is the right construct either. Note that I tested
this on Windows, and at least in our buildsystem (where we use forward
slashes on the compiler command lines) __FILE__ contains forward slashes.
So to make it clear. This patch now does the following:
* Removes the setting of -DTHIS_FILE=... from all compilation units
involved in building Hotspot.
* Introduces THIS_FILE as a macro in Hotspot src which gets just the
filename from the __FILE__ macro.
* Changes the use of the __FILE__/THIS_FILE macro in exceptions.hpp to
just always use the new THIS_FILE.
* Introduces the use of -fmacro-file-map, when supported by the
compiler, to rewrite __FILE__ to a path relative to the workspace root.
The two main improvements from this are that precompiled headers should
start working with GCC again and when building with GCC 8 or later, we
get rid of absolute paths from our binaries.
/Erik
More information about the build-dev
mailing list