summaryrefslogtreecommitdiff
path: root/project.conf
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-10-26 14:52:08 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2017-10-26 14:59:22 +0000
commit8e880181f2cb365c80f0b05ac452710ece8a9d0c (patch)
tree57089129e30a1ae448fb2720ae32bd46e67decc6 /project.conf
parentdb515d743345d183312cfb1af19153b3b8a78ece (diff)
downloaddefinitions-8e880181f2cb365c80f0b05ac452710ece8a9d0c.tar.gz
Disable debug section compression in stage3
The objcopy tool that we built in stage2 doesn't have zlib support, so it can't handle the `--compress-debug-sections` flag that BuildStream passes by default.
Diffstat (limited to 'project.conf')
-rw-r--r--project.conf26
1 files changed, 26 insertions, 0 deletions
diff --git a/project.conf b/project.conf
index 18023773..699a1ce8 100644
--- a/project.conf
+++ b/project.conf
@@ -34,6 +34,32 @@ variables:
%{target-stage1}-strip --remove-section=.comment --remove-section=.note --strip-unneeded "$1"
%{target-stage1}-objcopy --add-gnu-debuglink "$debugfile" "$1"' - {} ';'
+ # BuildStream passes `--compress-debug-sections` to objcopy; this would be
+ # great if it worked but in stage3 builds I see errors like this:
+ #
+ # BFD: /buildstream/install/usr/bin/gcc-ranlib: unable to initialize compress status for section .debug_aranges
+ # objcopy:/buildstream/install/usr/bin/gcc-ranlib: Invalid operation
+ #
+ # This causes debug stripping to just not happen, which makes the stage3
+ # sysroot huge. I haven't investigated the cause, but I guess we need to
+ # build zlib in stage2 for the feature to work.
+ stage3-strip-binaries: |
+ find "%{install-root}" -type f \
+ '(' -perm -111 -o -name '*.so*' \
+ -o -name '*.cmxs' -o -name '*.node' ')' \
+ -exec sh -ec \
+ 'read -n4 hdr <"$1" # check for elf header
+ if [ "$hdr" != "$(printf \\x7fELF)" ]; then
+ exit 0
+ fi
+ debugfile="%{install-root}%{debugdir}/$(basename "$1")"
+ mkdir -p "$(dirname "$debugfile")"
+ objcopy --only-keep-debug "$1" "$debugfile"
+ chmod 644 "$debugfile"
+ strip --remove-section=.comment --remove-section=.note --strip-unneeded "$1"
+ objcopy --add-gnu-debuglink "$debugfile" "$1"' - {} ';'
+
+
artifacts:
pull-url: https://ostree.baserock.org/cache/