JDK-8036003: Add variable not to separate debug information.

Yasumasa Suenaga yasu at ysfactory.dip.jp
Mon Mar 3 12:04:51 UTC 2014


Hi David,

> Moving forward I think we would need to expose the strip-policy via a
> configure option and have that pass STRIP_POLICY through to both hotspot
> and the Images target.

I want you to do so :-)
Additionally, 

>>> 1. Generating debug symbols in the binaries (via gcc -g or whatever)
>>> 2. Generating debuginfo files (zipped or not) (FDS)
>>> 3. Stripping debug symbols from the binaries (strip-policy)

I think that FDS should be separated 1 from 2.
That is more useful for building OpenJDK.


> That said, as per the above I think you can achieve what you
> want by enabling FDS but set STRIP_POLICY to none, and set
> POST_STRIP_CMD to empty.

I tried:

  $ make images STRIP_POLICY=no_strip POST_STRIP_CMD=""

I was able to get binaries which is included debug information.


Thanks,

Yasumasa

On 2014/03/03 13:39, David Holmes wrote:
> Hi,
> 
> On 2/03/2014 12:07 AM, Yasumasa Suenaga wrote:
>> Hi David,
>>
>>> 1. Generating debug symbols in the binaries (via gcc -g or whatever)
>>> 2. Generating debuginfo files (zipped or not) (FDS)
>>> 3. Stripping debug symbols from the binaries (strip-policy)
>>>
>>> It may be that we don't have clean separation between them, and if so
>>> that should be fixed, but I don't see the current proposal as the way
>>> forward.
>>
>> Currently, 1. depends 2. If FDS set to disable, debug symbols (-g) are not
>> generated.
> 
> Okay. That would seem potentially inconvenient but not really critical.
> You simply enable FDS (the mere existence of the debuginfo files
> "shouldn't" cause a problem). Then you only need to address #3 -
> strip-policy.
> 
>> SEPARATED_DEBUGINFO_FILES which my patch provides can separate them.
>>
>>
>>> Also there may well be differences between how things are handled on the
>>> JDK side and hotspot side.
>>
>> libjvm, libjsig. libsaproc are built with each makefiles in hotspot/make .
>> Other native library is built with make/common/NativeCompilation.gmk .
>>
>> Additionally strip command is executed in "image" target which is defined
>> in jdk/make/Images.gmk . This "strip" ignores STRIP_POLICY . Thus ELF binaries
>> which are contained in JDK/JRE images are stripped when we execute "images"
>> or "all" target.
> 
> strip is also applied to the JVM libraries as part of the hotspot build.
> What occurs in the JDK "images" is additional to that.The hotspot build
> honors the STRIP_POLICY.
> 
> It appears that STRIP_POLICY is not considered in the new build, though
> it was for the old. But perhaps I'm missing it somewhere in the autoconf
> settings? That aside it seems that you should be able to set
> POST_STRIP_CMD to "" avoid stripping.
> 
> Moving forward I think we would need to expose the strip-policy via a
> configure option and have that pass STRIP_POLICY through to both hotspot
> and the Images target.
> 
>>
>> So I change:
>>
>>    1. Separating to add "-g" option to compiler from executing objcopy.
>>    2. jdk/make/Images.gmk regards STRIP_POLICY.
>>
>>
>> As I mentioned earlier, this issue is related to RPM.
>> So I hope to fix it before JDK8 GA is released.
> 
> As Mike said there is no chance of any changes to this getting into 8
> GA. But if these are your own builds I'm not sure that is an issue
> anyway. That said, as per the above I think you can achieve what you
> want by enabling FDS but set STRIP_POLICY to none, and set
> POST_STRIP_CMD to empty.
> 
> Thanks,
> David
> 
>>
>> Thanks,
>>
>> Yasumasa
>>
>>
>> On 2014/03/01 8:47, David Holmes wrote:
>>> On 1/03/2014 1:38 AM, Yasumasa Suenaga wrote:
>>>>> The proper way to fix this is to disable FDS.
>>>>
>>>> Does this mean I have to pass --disable-debug-symbols to configure ?
>>>> I've added comment to JDK-8036003, I think if we pass --disable-debug-symbols
>>>> to configure, gcc/g++ is not passed -g option. "-g" is needed to generate
>>>> debuginfo.
>>>
>>> There are three pieces to all of this:
>>>
>>> 1. Generating debug symbols in the binaries (via gcc -g or whatever)
>>> 2. Generating debuginfo files (zipped or not) (FDS)
>>> 3. Stripping debug symbols from the binaries (strip-policy)
>>>
>>> It may be that we don't have clean separation between them, and if so
>>> that should be fixed, but I don't see the current proposal as the way
>>> forward.
>>>
>>> Also there may well be differences between how things are handled on the
>>> JDK side and hotspot side.
>>>
>>> I will try to look closer if I get a chance but my time is limited at
>>> the moment.
>>>
>>> David
>>>
>>>>
>>>> Thanks,
>>>>
>>>> Yasumasa
>>>>
>>>>
>>>> On 2014/02/28 23:04, Daniel D. Daugherty wrote:
>>>>> The proper way to fix this is to disable FDS. We should not need
>>>>> yet another option to control debug info.
>>>>>
>>>>> Dan
>>>>>
>>>>>
>>>>> On 2/28/14 4:13 AM, David Holmes wrote:
>>>>>> Hi,
>>>>>>
>>>>>> As I put in the bug report this seems way too complicated. Seems to me
>>>>>> all you need to do to get what you want is not use FDS and not strip the
>>>>>> symbols from the binary. The former is trivial. The latter is more
>>>>>> awkward as the strip policy stuff does not work as I would want it to
>>>>>> work, but still doable.
>>>>>>
>>>>>> David
>>>>>>
>>>>>> On 28/02/2014 7:18 PM, Yasumasa Suenaga wrote:
>>>>>>> Hi all,
>>>>>>>
>>>>>>>
>>>>>>> Currently, configure script can accept --disable-debug-symbols and
>>>>>>> --disable-zip-debug-info as controlling to generate debug information.
>>>>>>> However, current makefiles cannot build ELF binaries which is contained
>>>>>>> debug information with "images" target.
>>>>>>>
>>>>>>> Some Linux distros use RPM as package manager.
>>>>>>> RPM is built by rpmbuild command, it strips symbols and debug information
>>>>>>> during to generate rpm packages.
>>>>>>> https://fedoraproject.org/wiki/Packaging:Debuginfo
>>>>>>>
>>>>>>> For example, OpenJDK8 in Fedora20 ships libjvm.so and libjvm.debuginfo .
>>>>>>> libjvm.debuginfo is generated in OpenJDK's makefiles, however it does not
>>>>>>> contain debug information. Actual debug information is shipped by OpenJDK
>>>>>>> debuginfo package.
>>>>>>> This packaging is important when we have to debug JVM/JNI libraries.
>>>>>>> If we want to use debugging tools (GDB, SystemTap, etc...), they may requires
>>>>>>> debuginfo package. Debuggee (e.g. libjvm.so) points libjvm.so.debug which is
>>>>>>> located at sub directory in /usr/lib/debug . It is defined in ELF section
>>>>>>> (.note.gnu.build-id) of libjvm.so . However libjvm.so.debug does not contain
>>>>>>> valid debug information. We need to access libjvm.debuginfo.debug at same location.
>>>>>>>
>>>>>>>
>>>>>>> When we think to build OpenJDK rpm packages, we have to build ELF binaries
>>>>>>> which contain all debug information. we should not to separate debug information.
>>>>>>>
>>>>>>>
>>>>>>> Thus I want to add a variable "SEPARATED_DEBUGINFO_FILES" .
>>>>>>> If we pass "SEPARATED_DEBUGINFO_FILES=false" to make command, "make" does not
>>>>>>> execute objcopy command for generating debuginfo binaries.
>>>>>>>
>>>>>>> If we build rpm packages, we also have to add "STRIP_POLICY=no_strip" to arguments
>>>>>>> of make command. Or ELF binaries will be stripped.
>>>>>>>
>>>>>>>
>>>>>>> I've uploaded webrev for this enhancement.
>>>>>>> This is separated 3-part: top of forest, hotspot, jdk
>>>>>>> http://cr.openjdk.java.net/~ysuenaga/JDK-8036003/
>>>>>>>
>>>>>>> Please review it and sponsoring!
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Yasumasa
>>>>>>>
>>>>>>>
>>>>>>> P.S.
>>>>>>>         I tried to add SEPARATED_DEBUGINFO_FILES as a configure option like
>>>>>>>         "--disable-separated-debug-info" .
>>>>>>>         I ran configure which is located at jdk9/dev directory after I ran autoconf
>>>>>>>         and common/autoconf/autogen.sh. However it failed.
>>>>>>>
>>>>>>>         I guess this is caused by changeset as below.
>>>>>>>            JDK-8035495: Improvements in autoconf integration
>>>>>>>            http://hg.openjdk.java.net/jdk9/dev/rev/6e29cd9ac2b4
>>>>>>>
>>>>>>>         This changes add "CHECKME" option to configure script. However, this changes
>>>>>>>         affects "configure" only. It should change "configure.ac" .
>>>>>>>
>>>>>
>>>>
>>>
>>
> 




More information about the core-libs-dev mailing list