diff --git a/pisi/configfile.py b/pisi/configfile.py index 133dd6a8..a5beeb35 100644 --- a/pisi/configfile.py +++ b/pisi/configfile.py @@ -23,6 +23,7 @@ # #[build] #host = i686-pc-linux-gnu +#debug = False #jobs = "-j1" #CFLAGS= -mtune=i686 -O2 -pipe -fomit-frame-pointer #CXXFLAGS= -mtune=i686 -O2 -pipe -fomit-frame-pointer @@ -62,6 +63,7 @@ class BuildDefaults: """Default values for [build] section""" host = "i686-pc-linux-gnu" jobs = "-j1" + debug = False CFLAGS = "-mtune=i686 -O2 -pipe -fomit-frame-pointer" CXXFLAGS = "-mtune=i686 -O2 -pipe -fomit-frame-pointer" LDFLAGS = "" diff --git a/pisi/util.py b/pisi/util.py index 8617836b..7ad8fea7 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -466,15 +466,32 @@ def strip_file(filepath): if ret: ctx.ui.warning(_("strip command failed for file '%s'!") % f) + def save_elf_debug(f): + """copy debug info into /debug/file.debug file""" + p = os.popen("objcopy --only-keep-debug %s /debug/%s.debug" % (f, os.path.basename(f))) + ret = p.close() + if ret: + ctx.ui.warning(_("objcopy (keep-debug) command failed for file '%s'!") % f) + + """mark binary/shared objects to use /debug/file.debug""" + p = os.popen("objcopy --add-gnu-debuglink=/debug/%s.debug %s" % (os.path.basename(f), f)) + ret = p.close() + if ret: + ctx.ui.warning(_("objcopy (add-debuglink) command failed for file '%s'!") % f) + if "current ar archive" in o: run_strip(filepath, "-g") return True elif "SB executable" in o: + if ctx.config.values.build.debug == "True": + save_elf_debug(filepath) run_strip(filepath) return True elif "SB shared object" in o: + if ctx.config.values.build.debug == "True": + save_elf_debug(filepath) run_strip(filepath, "--strip-unneeded") # FIXME: warn for TEXTREL return True