gcc: extend stripping of .a libraries and .o objects
The initial intent was to strip .a and .o files, not .a.o files. While at it expanded stripping for $lib output as well. Without the change `libgcc.a` was not stripped and `.debug*` sections made into final binaries. It's not a problem on it's own, but it's an unintended side-effect. Noticed on `crystal_1_0` test failure where `crystal` was not able to handle `dwarf-5`. While at it allowed absolute file names to be passed to stripDebugList and friends.
This commit is contained in:
@@ -44,7 +44,7 @@ stripDirs() {
|
|||||||
|
|
||||||
local d
|
local d
|
||||||
for d in ${dirs}; do
|
for d in ${dirs}; do
|
||||||
if [ -d "$prefix/$d" ]; then
|
if [ -e "$prefix/$d" ]; then
|
||||||
dirsNew="${dirsNew} $prefix/$d "
|
dirsNew="${dirsNew} $prefix/$d "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
# Example ARM breakage by x86_64 strip: https://bugs.gentoo.org/697428
|
# Example ARM breakage by x86_64 strip: https://bugs.gentoo.org/697428
|
||||||
#
|
#
|
||||||
# Let's recap the file layout for directories with object files for a
|
# Let's recap the file layout for directories with object files for a
|
||||||
# cross-compiler (host != target):
|
# cross-compiler:
|
||||||
|
#
|
||||||
|
# $out (host != target)
|
||||||
# `- bin: HOST
|
# `- bin: HOST
|
||||||
# lib/*.{a,o}: HOST
|
# lib/*.{a,o}: HOST
|
||||||
# `- gcc/<TARGET>/<VERSION>/*.{a,o}: TARGET
|
# `- gcc/<TARGET>/<VERSION>/*.{a,o}: TARGET
|
||||||
@@ -17,10 +19,16 @@
|
|||||||
# `- libexec/: HOST
|
# `- libexec/: HOST
|
||||||
# `- <TARGET>/: TARGET
|
# `- <TARGET>/: TARGET
|
||||||
#
|
#
|
||||||
# (host == target) has identical directory layout.
|
# $out (host == target) has identical directory layout.
|
||||||
|
#
|
||||||
|
# $lib (host != target):
|
||||||
|
# `- <TARGET>/lib/*.{la,so}: TARGET
|
||||||
|
#
|
||||||
|
# $lib (host == target):
|
||||||
|
# `- lib/*.{la,so}: HOST
|
||||||
|
|
||||||
# The rest of stripDebugList{Host,Target} will be populated in
|
# The rest of stripDebugList{Host,Target} will be populated in
|
||||||
# postInstall.
|
# postInstall to disambiguate lib/ object files.
|
||||||
stripDebugList = [ "bin" "libexec" ];
|
stripDebugList = [ "bin" "libexec" ];
|
||||||
stripDebugListTarget = [ stdenv.targetPlatform.config ];
|
stripDebugListTarget = [ stdenv.targetPlatform.config ];
|
||||||
|
|
||||||
@@ -32,21 +40,28 @@
|
|||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
pushd $out
|
pushd $out
|
||||||
|
local -ar outHostFiles=(
|
||||||
local -ar hostFiles=(
|
lib{,32,64}/*.{a,o,so*}
|
||||||
lib{,32,64}/*.{a.o}
|
|
||||||
lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/plugin
|
lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/plugin
|
||||||
)
|
)
|
||||||
local -ar targetFiles=(
|
local -ar outTargetFiles=(
|
||||||
lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/*.{a.o}
|
lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/*.{a,o,so*}
|
||||||
)
|
)
|
||||||
|
popd
|
||||||
|
|
||||||
stripDebugList="$stripDebugList ''${hostFiles[*]}"
|
pushd $lib
|
||||||
stripDebugListTarget="$stripDebugListTarget ''${targetFiles[*]}"
|
local -ar libHostFiles=(
|
||||||
|
lib{,32,64}/*.{a,o,so*}
|
||||||
|
)
|
||||||
|
local -ar libTargetFiles=(
|
||||||
|
lib{,32,64}/${stdenv.targetPlatform.config}/*.{a,o,so*}
|
||||||
|
)
|
||||||
popd
|
popd
|
||||||
|
|
||||||
eval "$oldOpts"
|
eval "$oldOpts"
|
||||||
|
|
||||||
|
stripDebugList="$stripDebugList ''${outHostFiles[*]} ''${libHostFiles[*]}"
|
||||||
|
stripDebugListTarget="$stripDebugListTarget ''${outTargetFiles[*]} ''${libTargetFiles[*]}"
|
||||||
}
|
}
|
||||||
updateDebugListPaths
|
updateDebugListPaths
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user