]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
stripper: Strip all unneeded relocation information stripper
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 Dec 2019 12:54:22 +0000 (12:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 21 Dec 2019 12:37:11 +0000 (12:37 +0000)
Libraries were treated differently and therfore it could
happen that they were not stripped from any unnecessary
relocation information at all.

This patch changes that and strips everything from
libraries that we do not need.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
make.sh
src/stripper

diff --git a/make.sh b/make.sh
index 64b08b7d9bbdedf19dffab9133a3bba20de875ce..5765f67d7e6bb975c9e97a90671094a937c857b8 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -198,7 +198,7 @@ configure_build() {
        # Enables hardening
        HARDENING_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong"
 
-       CFLAGS="-O2 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
+       CFLAGS="-O2 -g -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
        CXXFLAGS="${CFLAGS}"
 
        # Determine parallelism
index f121d35919fb967c6469c54b32d4f791ea631480..8beb9f6cd5bb0291934ab079d5dcbb86f7bfab07 100755 (executable)
@@ -17,7 +17,7 @@ done
 
 function _strip() {
        local file=${1}
-       local cmd="${STRIP-strip}"
+       local strip="${STRIP-strip}"
 
        local exclude l
        for exclude in ${excludes}; do
@@ -27,17 +27,16 @@ function _strip() {
                fi
        done
 
+       local cmd=( "${strip}" "--strip-unneeded" )
+
        case "$(file -bi ${file})" in
-               application/x-sharedlib*|application/x-archive*)
-                       cmd="${cmd} --strip-debug --remove-section=.comment --remove-section=.note"
-                       ;;
-               *)
-                       cmd="${cmd} --strip-unneeded"
+               application/x-sharedlib*)
+                       cmd+=( "--strip-debug" "--remove-section=.comment" "--remove-section=.note" )
                        ;;
        esac
 
        echo "Stripping ${file}..."
-       ${cmd} ${file}
+       ${cmd[*]} ${file}
 }
 
 for dir in ${dirs}; do