crosutil: automatically strip CFI when uploading x86 symbols

BUG=chromium-os:21030 chromium-os:21417
TEST=test uploads with ARM and x86 targets
test that Chrome symbols are ~87M when stripped down from ~160MB

Change-Id: I9207b3f6a5b757ffa58468c58b4440467dc44738
Reviewed-on: http://gerrit.chromium.org/gerrit/8777
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Michael Krebs <mkrebs@chromium.org>
Reviewed-by: Ken Mixter <kmixter@chromium.org>
Tested-by: Ken Mixter <kmixter@chromium.org>
Commit-Ready: Ken Mixter <kmixter@chromium.org>
This commit is contained in:
Ken Mixter 2011-10-04 17:35:39 -07:00 committed by Gerrit
parent 4474c15e7b
commit 243590f4ba

View File

@ -39,6 +39,7 @@ DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for."
DEFINE_string breakpad_root "" "Root directory for breakpad symbols."
DEFINE_boolean official_build ${FLAGS_FALSE} "Point to official symbol server."
DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols."
DEFINE_boolean strip_x86_cfi ${FLAGS_TRUE} "Strip CFI data for x86."
DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose."
DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts."
@ -72,15 +73,31 @@ function really_upload() {
# Upload the given symbol file to given URL.
function upload_file() {
local upload_file="$1"
local symbol_file="$1"
local upload_url="$2"
local upload_file="${symbol_file}"
if [ ${FLAGS_strip_x86_cfi} -eq ${FLAGS_TRUE} ]; then
local arch=$(portageq-${FLAGS_board} envvar ARCH)
if [ "${arch}" == "x86" ]; then
# Call frame info is unnecessary for 32b x86 targets with frame
# pointer used (as all of ours have) and it accounts for over
# half the size of the symbols uploaded. To buy us more time
# for the server team to increase the current 160MB, remove this
# data unless the user requests it.
if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then
info "Stripping CFI for ${symbol_file} due to board ${FLAGS_board}."
fi
upload_file="${OUT_DIR}/stripped.sym"
sed '/^STACK CFI/d' < "${symbol_file}" > "${upload_file}"
fi
fi
if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ]; then
info "Uploading ${upload_file}"
info "Uploading ${symbol_file}"
fi
"${SYM_UPLOAD}" "${upload_file}" "${upload_url}" > "${OUT_DIR}/stdout" \
2> "${OUT_DIR}/stderr"
if ! grep -q "Successfully sent the symbol file." "${OUT_DIR}/stdout"; then
error "Unable to upload symbols in ${upload_file}:"
error "Unable to upload symbols in ${symbol_file}:"
cat "${OUT_DIR}/stderr"
ANY_ERRORS=1
return 1