Skip to contentSkip to conversation

Fix some package issues, and add new features

PATCH In review Mark Hatle 2 participants 5 messages Feb 7, 2020 – Apr 16, 2020

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

cover Fix some package issues, and add new features

While working on baremetal toolchains, I found that the SDKs were potentially very very large. I investigated and found it was due to included debug info, but realize the associated source files were not actually present.

Patch 1/3 - Fixes identification of corresponding dwarf debug sources Patch 2/3 - Allow us to skip kernel modules and static libraries Patch 3/3 - Add a -dbg like behavior for static libraries (off by default)

Mark Hatle (3):
package.bbclass: Fix debug source processing for static libraries package.bbclass: Allow INHIBIT_PACKAGE_STRIP_FILES to skip .ko and
static libs
package.bbclass: Support stripping and debug copy of static libraries

 meta/classes/insane.bbclass  |  2 +-
 meta/classes/package.bbclass | 80 ++++++++++++++++++++++++++++++++----
 meta/conf/bitbake.conf       |  2 +-
 3 files changed, 73 insertions(+), 11 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/3 package.bbclass: Fix debug source processing for static libraries

Format of the sources list is the [ (file, [source, ...]), ... ] before this change, the static libraries were processed but the items were included incorrectly causing no sources for static libraries to be included.

---
 meta/classes/package.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/package.bbclass +1 -1
index ef3de35961..46ec9b6b3a 100644
@@ -1051,7 +1051,7 @@ python split_and_strip_files () {
 
         if debugsrcdir and not targetos.startswith("mingw"):
             for file in staticlibs:
-                results.extend(source_info(file, d, fatal=False))
+                results.append( (file, source_info(file, d, fatal=False)) )
 
         sources = set()
         for r in results:
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/3 package.bbclass: Allow INHIBIT_PACKAGE_STRIP_FILES to skip .ko and static libs

In reply to Mark Hatle

Change the order of the skip processing to happen before any .ko and static library processing. This will allow these types of files to be individually skipped if necessary.

---
 meta/classes/package.bbclass | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
meta/classes/package.bbclass +7 -6
index 46ec9b6b3a..7080d63287 100644
@@ -955,12 +955,6 @@ python split_and_strip_files () {
         for root, dirs, files in cpath.walk(dvar):
             for f in files:
                 file = os.path.join(root, f)
-                if file.endswith(".ko") and file.find("/lib/modules/") != -1:
-                    kernmods.append(file)
-                    continue
-                if oe.package.is_static_lib(file):
-                    staticlibs.append(file)
-                    continue
 
                 # Skip debug files
                 if debugappend and file.endswith(debugappend):
@@ -971,6 +965,13 @@ python split_and_strip_files () {
                 if file in skipfiles:
                     continue
 
+                if file.endswith(".ko") and file.find("/lib/modules/") != -1:
+                    kernmods.append(file)
+                    continue
+                if oe.package.is_static_lib(file):
+                    staticlibs.append(file)
+                    continue
+
                 try:
                     ltarget = cpath.realpath(file, dvar, False)
                     s = cpath.lstat(ltarget)
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH 3/3 package.bbclass: Support stripping and debug copy of static libraries

In reply to Mark Hatle

By default, we won't copy and strip static libraries. However, this functionality can be useful in some cases where people are doing development on the target, and don't generally want the larger debug capable static libraries. To enable the new functionality set:

PACKAGE_DEBUG_STATIC_SPLIT = '1'

Add a new function splitstaticdebuginfo. Thus function will copy the unmodified static library into the specific debug directory location. By keeping an unmodified version, it is possible for a user trying to debug something to use -L /usr/lib/.debug-static and their existing build commands to switch from stripped to full debug versions.

The PACKAGE_DEBUG_SPLIT_STYLE will select between two different approaches, /usr/lib/debug-static or <path>/.debug-static.

Additionally you can now choose to strip static libraries to conserve space. If either 'PACKAGE_DEBUG_STATIC_SPLIT' or 'PACKAGE_STRIP_STATIC' is set to 1, the static library will be stripped. (This is not on by default, as it could make diagnosing static library usage difficult in some cases.)

Add to insane.bbclass a skip to the staticdev warning for the specific -dbg package versions.

---
 meta/classes/insane.bbclass  |  2 +-
 meta/classes/package.bbclass | 67 ++++++++++++++++++++++++++++++++++--
 meta/conf/bitbake.conf       |  2 +-
 3 files changed, 66 insertions(+), 5 deletions(-)
meta/classes/insane.bbclass +1 -1
index 795c7b9212..7425b8cbd5 100644
@@ -182,7 +182,7 @@ def package_qa_check_staticdev(path, name, d, elf, messages):
     libgcc.a, libgcov.a will be skipped in their packages
     """
 
-    if not name.endswith("-pic") and not name.endswith("-staticdev") and not name.endswith("-ptest") and path.endswith(".a") and not path.endswith("_nonshared.a"):
+    if not name.endswith("-pic") and not name.endswith("-staticdev") and not name.endswith("-ptest") and path.endswith(".a") and not path.endswith("_nonshared.a") and not '/usr/lib/debug-static/' in path and not '/.debug-static/' in path:
         package_qa_add_message(messages, "staticdev", "non -staticdev package contains static .a library: %s path '%s'" % \
                  (name, package_qa_clean_path(path,d)))
 
meta/classes/package.bbclass +64 -3

116 lines not on this page · raw message

meta/conf/bitbake.conf +1 -1
index 8b4621f9b9..954c06b313 100644
@@ -325,7 +325,7 @@ FILES_${PN}-staticdev = "${libdir}/*.a ${base_libdir}/*.a ${libdir}/${BPN}/*.a"
 SECTION_${PN}-staticdev = "devel"
 RDEPENDS_${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})"
 
-FILES_${PN}-dbg = "/usr/lib/debug /usr/src/debug"
+FILES_${PN}-dbg = "/usr/lib/debug /usr/lib/debug-static /usr/src/debug"
 SECTION_${PN}-dbg = "devel"
 ALLOW_EMPTY_${PN}-dbg = "1"
 
Signature · 1 line
2.17.1
#4 lore raw

Re: [OE-core] [PATCH 3/3] package.bbclass: Support stripping and debug copy of static libraries

Quoted 39 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Mark Hatle
Sent: den 7 februari 2020 21:20
To: [email protected]
Subject: [OE-core] [PATCH 3/3] package.bbclass: Support stripping and debug copy of static libraries

By default, we won't copy and strip static libraries. However, this functionality can be useful in some cases where people are doing development on the target, and don't generally want the larger debug capable static libraries. To enable the new functionality set:

PACKAGE_DEBUG_STATIC_SPLIT = '1'

Add a new function splitstaticdebuginfo. Thus function will copy the unmodified static library into the specific debug directory location. By keeping an unmodified version, it is possible for a user trying to debug something to use -L /usr/lib/.debug-static and their existing build commands to switch from stripped to full debug versions.

The PACKAGE_DEBUG_SPLIT_STYLE will select between two different approaches, /usr/lib/debug-static or <path>/.debug-static.

Additionally you can now choose to strip static libraries to conserve space. If either 'PACKAGE_DEBUG_STATIC_SPLIT' or 'PACKAGE_STRIP_STATIC' is set to 1, the static library will be stripped. (This is not on by default, as it could make diagnosing static library usage difficult in some cases.)

Add to insane.bbclass a skip to the staticdev warning for the specific -dbg package versions.

---
 meta/classes/insane.bbclass  |  2 +-
 meta/classes/package.bbclass | 67 ++++++++++++++++++++++++++++++++++--
 meta/conf/bitbake.conf       |  2 +-
 3 files changed, 66 insertions(+), 5 deletions(-)

[cut]

Quoted 4 lines
meta/classes/package.bbclass +0 -0
index 7080d63287..1efc396ac6 100644

[cut]

meta/classes/package.bbclass python split_and_strip_files () { · line 1113

Quoted 11 lines
meta/classes/package.bbclass +5 -2
@@ -1051,8 +1106,11 @@ python split_and_strip_files () {
         results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, debugdir, debuglibdir, debugappend, debugsrcdir, d))
 
         if debugsrcdir and not targetos.startswith("mingw"):
-            for file in staticlibs:
-                results.append( (file, source_info(file, d, fatal=False)) )
+            if (d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'):
+                results = oe.utils.multiprocess_launch(splitstaticdebuginfo, staticlibs, d, extraargs=(dvar, debugstaticdir, debugstaticlibdir, debugstaticappend, debugsrcdir, d))
+            else:
+                for file in staticlibs:
+                    results.append( (file,source_info(file, d)) )

Why was fatal=False dropped from the call to source_info()?

//Peter