8 # Note [Cross-compiler stripping]
9 # gcc requires delicate stripping as it installs ELF files for both
10 # HOST and TARGET platforms. It requires according strip tool otherwise
11 # strip could remove sections it's not aware of.
12 # Example ARM breakage by x86_64 strip: https://bugs.gentoo.org/697428
14 # Let's recap the file layout for directories with object files for a
17 # $out (host != target)
20 # `- gcc/<TARGET>/<VERSION>/*.{a,o}: TARGET
22 # `- lib{,32,64,x32}: symlink to lib or identical layout
24 # `- <TARGET>/: TARGET
26 # $out (host == target) has identical directory layout.
28 # $lib (host != target):
29 # `- <TARGET>/lib/*.{la,so}: TARGET
31 # $lib (host == target):
32 # `- lib/*.{la,so}: HOST
34 # The rest of stripDebugList{Host,Target} will be populated in
35 # postInstall to disambiguate lib/ object files.
40 stripDebugListTarget = [ stdenv.targetPlatform.config ];
44 # Populate most delicated lib/ part of stripDebugList{,Target}
45 updateDebugListPaths() {
47 oldOpts="$(shopt -p nullglob)" || true
51 local -ar outHostFiles=(
52 lib{,32,64}/*.{a,o,so*}
53 lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/plugin
55 local -ar outTargetFiles=(
56 lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/*.{a,o,so*}
60 + lib.optionalString (!langJit) ''
66 local -ar libHostFiles=(
67 lib{,32,64}/*.{a,o,so*}
69 local -ar libTargetFiles=(
70 lib{,32,64}/${stdenv.targetPlatform.config}/*.{a,o,so*}
78 stripDebugList="$stripDebugList ''${outHostFiles[*]} ''${libHostFiles[*]}"
79 stripDebugListTarget="$stripDebugListTarget ''${outTargetFiles[*]} ''${libTargetFiles[*]}"