RFR: 8214796: Create a jlink plugin for stripping debug info symbols from native libraries

Mandy Chung mandy.chung at oracle.com
Tue Feb 12 23:29:28 UTC 2019

On 2/12/19 11:52 AM, Severin Gehwolf wrote:
> Hi Mandy, Alan,
> Please find the proposal for CLI option of --strip-native-debug-symbols
> below.
> The current implementation here has the following options:
> http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8214796/05/webrev/
> [i]   --strip-native-debug-symbols defaults
> [ii]  --strip-native-debug-symbols options:objcopy-cmd=<path/to/objcopycmd>
> [iii] --strip-native-debug-symbols options:debuginfo-file-ext=<ext>
> [iv]  --strip-native-debug-symbols options:include-debug-syms=true
> The first option is a work-around for JDK-8218761. AFAIUI, fixing it
> will need rework of the Plugin interface and probably of the options
> parsing. Hence, I'd like to defer this post integration of the initial
> version of --strip-native-debug-symbols plugin.
> Cases [iii] and [iv] can be folded into one as suggested by Mandy with:
> --strip-native-debug-symbols keep-debuginfo
> --strip-native-debug-symbols keep-debuginfo=<ext>
> Case [ii] would become:
> --strip-native-debug-symbols objcopy=<path/to/objcopy>

we could relax this to a command that can contain arguments.

> So in summary I'd propose these, where a) and b) may be combined, c)
> and a) or c) and b) combined would be an error:
> [a] --strip-native-debug-symbols keep-debuginfo[=<ext>]
> [b] --strip-native-debug-symbols objcopy=<path/to/objcopy>
> [c] --strip-native-debug-symbols defaults

This is a good compromise.  When JDK-8218761 is implemented,
[c] can become `--strip-native-debug-symbols`

"defaults" is unclear to what it does.  What about
    --strip-native-debug-symbols no-keep-debuginfo

> As a follow-up to an initial implementation of the above, I'd propose
> to hook it up with the current --strip-debug by a follow-up patch. It
> would first rename --strip-debug to --strip-debug-attribute or perhaps
> --strip-java-debug-symbols, and then let --strip-debug perform java and
> native debug symbols stripping as Alan suggested.

The renaming can be done separately.  I would prefer changing
--strip-debug to invoke --strip-native-debug-symbols, if present,
at the same time with this new strip native debug symbols plugin
to ensure that they all go in the same release.

In other words, the renaming should be done before this new plugin.
That's my opinion.


> Does that sound reasonable to you?
> Thanks,
> Severin

More information about the build-dev mailing list