Skip to contentSkip to conversation

openjdk-8: remove debuglink

PATCH In review Wenlin Kang 2 participants 6 messages Jun 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 openjdk-8: remove debuglink

During openjdk-8 compiling, its debug file is xxx.debuginfo, and it will add libjvm.debuginfo as libjvm.so's debuglink section's file name, this name is different with that we will create and add in splitdebuginfo() of package.bbclass, in oe-core, the debug file name is the same with the corresponding executable file or library file, this will make we can't get symbol information when debug libjvm.so in gdb, so we must remove the previous debuglink before add it if it has existed(if a file has contained the debuglink section, it will not be changed when add again).

---
 recipes-core/openjdk/openjdk-8-cross.inc | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
recipes-core/openjdk/openjdk-8-cross.inc +16 -0
index 46f13fd..03cab11 100644
@@ -105,5 +105,21 @@ EXTRA_OEMAKE_append = '\
     images \
 '
 
+python remove_debuglink() {
+    dvar = d.getVar('PKGD', True)
+    objcopy = d.getVar("OBJCOPY", True)
+
+    # Remove the previous debuglink if it has existed, because it has a different file name with that we will add.
+    if d.getVar('PN', True).find("jre") != -1:
+        file = dvar + d.getVar("JRE_HOME", True) + "/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+    else:
+        file = dvar + d.getVar("JDK_HOME", True) + "/jre/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+
+    cmd = "'%s' --remove-section .gnu_debuglink '%s'" % (objcopy, file)
+    oe.utils.getstatusoutput(cmd)
+}
+
+PACKAGE_PREPROCESS_FUNCS += "remove_debuglink"
+
 # There is a symlink to a .so but this one is valid.
 INSANE_SKIP_${PN} = "dev-so"
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 2/2 openjdk-8: remove redunant FILES_${PN}-dbg

One recipe should only have one -dbg package, because OE only picks up all .debug file into the last one -dbg package listed in variable PACKAGES.

Comments(oe-core's commit a3b000643898d7402b9e57c02e8d10e677cc9722) from Ross Burton as below:
"meta: more removals of redunant FILES_${PN}-dbg

In some recipes overly-split -dbg packages were merged into PN-dbg. Unless there's a very good reason, recipes should have a single -dev and -dbg package. "

---
 recipes-core/openjdk/openjdk-8_16xbyy.bb | 29 -----------------------------
 1 file changed, 29 deletions(-)
recipes-core/openjdk/openjdk-8_16xbyy.bb +0 -29
index dd0ed1d..522d6b5 100644
@@ -14,7 +14,6 @@ do_install() {
 }
 
 PACKAGES_append = " \
-    ${PN}-demo-dbg \
     ${PN}-demo \
     ${PN}-source \
 "
@@ -33,37 +32,9 @@ FILES_${PN}-dev_append = "\
     ${JDK_HOME}/include \
 "
 
-FILES_${PN}-dbg_append = "\
-    ${JDK_HOME}/bin/.debug/ \
-    ${JDK_HOME}/lib/.debug/ \
-    ${JDK_HOME}/lib/${JDK_ARCH}/.debug/ \
-    ${JDK_HOME}/lib/${JDK_ARCH}/jli/.debug/ \
-    ${JDK_HOME}/jre/bin/.debug/ \
-    ${JDK_HOME}/jre/lib/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/jli/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/native_threads/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/server/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/headless/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/xawt/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/client/.debug/ \
-"
-
 FILES_${PN}-demo = " ${JDK_HOME}/demo ${JDK_HOME}/sample "
 RDEPENDS_${PN}-demo = " ${PN} "
 
-FILES_${PN}-demo-dbg = "\
-    ${JDK_HOME}/demo/jvmti/gctest/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/heapTracker/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/heapViewer/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/hprof/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/minst/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/mtrace/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/versionCheck/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/waiters/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/compiledMethodLoad/lib/.debug/ \
-"
-
 FILES_${PN}-doc_append = "\
     ${JDK_HOME}/man \
     ${JDK_HOME}/ASSEMBLY_EXCEPTION \
Signature · 1 line
2.11.0
Tested-by on v2 2/2
#2 lore raw

Re: [meta-java][PATCH V2 2/2] openjdk-8: remove redunant FILES_${PN}-dbg

Tested for qemuarm. Therefore feel free to add:

Quoted 68 lines · Wenlin Kang

One recipe should only have one -dbg package, because OE only picks up all .debug file into the last one -dbg package listed in variable PACKAGES.

Comments(oe-core's commit a3b000643898d7402b9e57c02e8d10e677cc9722) from Ross Burton as below:
"meta: more removals of redunant FILES_${PN}-dbg

In some recipes overly-split -dbg packages were merged into PN-dbg. Unless there's a very good reason, recipes should have a single -dev and -dbg package. "

---
 recipes-core/openjdk/openjdk-8_16xbyy.bb | 29 -----------------------------
 1 file changed, 29 deletions(-)
recipes-core/openjdk/openjdk-8_16xbyy.bb +0 -29
index dd0ed1d..522d6b5 100644
@@ -14,7 +14,6 @@ do_install() {
 }
 
 PACKAGES_append = " \
-    ${PN}-demo-dbg \
     ${PN}-demo \
     ${PN}-source \
 "
@@ -33,37 +32,9 @@ FILES_${PN}-dev_append = "\
     ${JDK_HOME}/include \
 "
 
-FILES_${PN}-dbg_append = "\
-    ${JDK_HOME}/bin/.debug/ \
-    ${JDK_HOME}/lib/.debug/ \
-    ${JDK_HOME}/lib/${JDK_ARCH}/.debug/ \
-    ${JDK_HOME}/lib/${JDK_ARCH}/jli/.debug/ \
-    ${JDK_HOME}/jre/bin/.debug/ \
-    ${JDK_HOME}/jre/lib/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/jli/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/native_threads/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/server/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/headless/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/xawt/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/client/.debug/ \
-"
-
 FILES_${PN}-demo = " ${JDK_HOME}/demo ${JDK_HOME}/sample "
 RDEPENDS_${PN}-demo = " ${PN} "
 
-FILES_${PN}-demo-dbg = "\
-    ${JDK_HOME}/demo/jvmti/gctest/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/heapTracker/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/heapViewer/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/hprof/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/minst/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/mtrace/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/versionCheck/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/waiters/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/compiledMethodLoad/lib/.debug/ \
-"
-
 FILES_${PN}-doc_append = "\
     ${JDK_HOME}/man \
     ${JDK_HOME}/ASSEMBLY_EXCEPTION \
#3 lore raw

Re: [meta-java][PATCH V2 2/2] openjdk-8: remove redunant FILES_${PN}-dbg

In reply to Wenlin Kang

Hi,
this is a note to let you know that I've just added this patch to the master-next branch of the meta-java repository at
git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be merged to the master branch.

If you have any questions, please let me know.

regards;Richard.L

Quoted 68 lines · Wenlin Kang

One recipe should only have one -dbg package, because OE only picks up all .debug file into the last one -dbg package listed in variable PACKAGES.

Comments(oe-core's commit a3b000643898d7402b9e57c02e8d10e677cc9722) from Ross Burton as below:
"meta: more removals of redunant FILES_${PN}-dbg

In some recipes overly-split -dbg packages were merged into PN-dbg. Unless there's a very good reason, recipes should have a single -dev and -dbg package. "

---
 recipes-core/openjdk/openjdk-8_16xbyy.bb | 29 -----------------------------
 1 file changed, 29 deletions(-)
recipes-core/openjdk/openjdk-8_16xbyy.bb +0 -29
index dd0ed1d..522d6b5 100644
@@ -14,7 +14,6 @@ do_install() {
 }
 
 PACKAGES_append = " \
-    ${PN}-demo-dbg \
     ${PN}-demo \
     ${PN}-source \
 "
@@ -33,37 +32,9 @@ FILES_${PN}-dev_append = "\
     ${JDK_HOME}/include \
 "
 
-FILES_${PN}-dbg_append = "\
-    ${JDK_HOME}/bin/.debug/ \
-    ${JDK_HOME}/lib/.debug/ \
-    ${JDK_HOME}/lib/${JDK_ARCH}/.debug/ \
-    ${JDK_HOME}/lib/${JDK_ARCH}/jli/.debug/ \
-    ${JDK_HOME}/jre/bin/.debug/ \
-    ${JDK_HOME}/jre/lib/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/jli/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/native_threads/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/server/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/headless/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/xawt/.debug/ \
-    ${JDK_HOME}/jre/lib/${JDK_ARCH}/client/.debug/ \
-"
-
 FILES_${PN}-demo = " ${JDK_HOME}/demo ${JDK_HOME}/sample "
 RDEPENDS_${PN}-demo = " ${PN} "
 
-FILES_${PN}-demo-dbg = "\
-    ${JDK_HOME}/demo/jvmti/gctest/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/heapTracker/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/heapViewer/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/hprof/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/minst/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/mtrace/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/versionCheck/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/waiters/lib/.debug/ \
-    ${JDK_HOME}/demo/jvmti/compiledMethodLoad/lib/.debug/ \
-"
-
 FILES_${PN}-doc_append = "\
     ${JDK_HOME}/man \
     ${JDK_HOME}/ASSEMBLY_EXCEPTION \
Tested-by on v2 1/2
#4 lore raw
In reply to Wenlin Kang

Tested for qemuarm. Therefore feel free to add:

Quoted 41 lines · Wenlin Kang

During openjdk-8 compiling, its debug file is xxx.debuginfo, and it will add libjvm.debuginfo as libjvm.so's debuglink section's file name, this name is different with that we will create and add in splitdebuginfo() of package.bbclass, in oe-core, the debug file name is the same with the corresponding executable file or library file, this will make we can't get symbol information when debug libjvm.so in gdb, so we must remove the previous debuglink before add it if it has existed(if a file has contained the debuglink section, it will not be changed when add again).

---
 recipes-core/openjdk/openjdk-8-cross.inc | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
recipes-core/openjdk/openjdk-8-cross.inc +16 -0
index 46f13fd..03cab11 100644
@@ -105,5 +105,21 @@ EXTRA_OEMAKE_append = '\
     images \
 '
 
+python remove_debuglink() {
+    dvar = d.getVar('PKGD', True)
+    objcopy = d.getVar("OBJCOPY", True)
+
+    # Remove the previous debuglink if it has existed, because it has a different file name with that we will add.
+    if d.getVar('PN', True).find("jre") != -1:
+        file = dvar + d.getVar("JRE_HOME", True) + "/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+    else:
+        file = dvar + d.getVar("JDK_HOME", True) + "/jre/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+
+    cmd = "'%s' --remove-section .gnu_debuglink '%s'" % (objcopy, file)
+    oe.utils.getstatusoutput(cmd)
+}
+
+PACKAGE_PREPROCESS_FUNCS += "remove_debuglink"
+
 # There is a symlink to a .so but this one is valid.
 INSANE_SKIP_${PN} = "dev-so"
#5 lore raw
In reply to Wenlin Kang

Hi,
this is a note to let you know that I've just added this patch to the master-next branch of the meta-java repository at
git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be merged to the master branch.

If you have any questions, please let me know.

regards;Richard.L

Quoted 41 lines · Wenlin Kang

During openjdk-8 compiling, its debug file is xxx.debuginfo, and it will add libjvm.debuginfo as libjvm.so's debuglink section's file name, this name is different with that we will create and add in splitdebuginfo() of package.bbclass, in oe-core, the debug file name is the same with the corresponding executable file or library file, this will make we can't get symbol information when debug libjvm.so in gdb, so we must remove the previous debuglink before add it if it has existed(if a file has contained the debuglink section, it will not be changed when add again).

---
 recipes-core/openjdk/openjdk-8-cross.inc | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
recipes-core/openjdk/openjdk-8-cross.inc +16 -0
index 46f13fd..03cab11 100644
@@ -105,5 +105,21 @@ EXTRA_OEMAKE_append = '\
     images \
 '
 
+python remove_debuglink() {
+    dvar = d.getVar('PKGD', True)
+    objcopy = d.getVar("OBJCOPY", True)
+
+    # Remove the previous debuglink if it has existed, because it has a different file name with that we will add.
+    if d.getVar('PN', True).find("jre") != -1:
+        file = dvar + d.getVar("JRE_HOME", True) + "/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+    else:
+        file = dvar + d.getVar("JDK_HOME", True) + "/jre/lib/" + d.getVar("JDK_ARCH", True) + "/server/libjvm.so"
+
+    cmd = "'%s' --remove-section .gnu_debuglink '%s'" % (objcopy, file)
+    oe.utils.getstatusoutput(cmd)
+}
+
+PACKAGE_PREPROCESS_FUNCS += "remove_debuglink"
+
 # There is a symlink to a .so but this one is valid.
 INSANE_SKIP_${PN} = "dev-so"