From 243590f4bab6136bc0b92b98ea39169b5a1f11ce Mon Sep 17 00:00:00 2001 From: Ken Mixter Date: Tue, 4 Oct 2011 17:35:39 -0700 Subject: [PATCH] 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 Reviewed-by: Michael Krebs Reviewed-by: Ken Mixter Tested-by: Ken Mixter Commit-Ready: Ken Mixter --- upload_symbols | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/upload_symbols b/upload_symbols index fe2123545d..163b60e887 100755 --- a/upload_symbols +++ b/upload_symbols @@ -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