New issue
Advanced search Search tips

Issue 805453 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocking:
issue 780980



Sign in to add a comment

mac 10.13 sdk builds warn about stripping globals during final link

Project Member Reported by ellyjo...@chromium.org, Jan 24 2018

Issue description

When doing an official build with the 10.13 SDK (after disabling the SDK version check):

[11480/29207] LINK obj/chrome/chrome_helper_app_executable/Google Chrome Helper
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: removing global symbols from a final linked no longer supported.  Use -exported_symbols_list at link time when building: /Users/ellyjones/p/chromium/src/out/rel-b/obj/chrome/chrome_helper_app_executable/Google Chrome Helper

I assume this will require some changes to our build files? Over to thakis@ for commentary :)
 
$ ninja -C out/rel-b -j 250 -v obj/chrome/chrome_helper_app_executable/Google\ Chrome\ Helper
ninja: Entering directory `out/rel-b'
[1/1] TOOL_VERSION=1478522852 ../../build/toolchain/mac/linker_driver.py ../../third_party/llvm-build/Release+Asserts/bin/clang++  -Wcrl,dsym,.  -Wcrl,strip,-s,../../chrome/app/app.saves -stdlib=libc++ -arch x86_64 -segprot PROTECTED_MEMORY rw r -Werror -Wl,-dead_strip -isysroot ../../../../../../../Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -mmacosx-version-min=10.9.0 -Wl,-ObjC -o "obj/chrome/chrome_helper_app_executable/Google Chrome Helper" -Wl,-filelist,"obj/chrome/chrome_helper_app_executable/Google Chrome Helper.rsp"  -lsandbox
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: removing global symbols from a final linked no longer supported.  Use -exported_symbols_list at link time when building: /Users/ellyjones/p/chromium/src/out/rel-b/obj/chrome/chrome_helper_app_executable/Google Chrome Helper

Comment 2 by thakis@chromium.org, Jan 24 2018

Owner: rsesek@chromium.org
the stripping in https://chromium.googlesource.com/chromium/src/+blame/15b1ec89853446a6c8a2c4330ffc72c941fdbfdc/build/toolchain/mac/linker_driver.py blames to rsesek

I don't know why we build with symbols and then strip; building the right thing in the first place like the tool recommends seems like a better thing on the surface. iirc we copy the unstripped bits somewhere though.

Maybe we just need to pass -x to strip?

Comment 3 by rsesek@chromium.org, Jan 24 2018

Cc: -rsesek@chromium.org thakis@chromium.org
I think we just need to replace -Wcrl,strip,-s,../../chrome/app/app.saves with -Wl,-exported_symbols_list,../../chrome/app/app.saves. We don't want to strip all local symbols in order to keep _main around for cleaner backtraces.

Comment 4 by thakis@chromium.org, Feb 15 2018

Blocking: 780980

Comment 5 by rsesek@chromium.org, Feb 15 2018

What version of Xcode was this with?

Comment 6 by rsesek@chromium.org, Feb 15 2018

Status: Started (was: Assigned)

Comment 7 by rsesek@chromium.org, Feb 15 2018

https://chromium-review.googlesource.com/#/c/chromium/src/+/922987

On 10.13.3 (17D47) with Xcode 9.2 (9C40b).

Before CL:
-rwxr-xr-x  2 rsesek  eng  9276 Feb 15 17:10 out/official/Chromium.app/Contents/MacOS/Chromium
-rwxr-xr-x  3 rsesek  eng  62828 Feb 15 16:35 out/official/Chromium.app/Contents/Versions/66.0.3349.0/Chromium Helper.app/Contents/MacOS/Chromium Helper

% nm out/official/Chromium.app/Contents/MacOS/Chromium
                 U __NSGetExecutablePath
                 U __ZdaPv
                 U __Znam
                 U ___error
                 U ___stderrp
0000000100000000 T __mh_execute_header
                 U _abort
                 U _dirname
                 U _dlerror
                 U _dlopen
                 U _dlsym
                 U _exit
                 U _fprintf
                 U _fwrite
0000000100000c50 T _main
                 U _snprintf
                 U _strerror
                 U _strlen
                 U dyld_stub_binder

% nm out/official/Chromium.app/Contents/Versions/66.0.3349.0/Chromium\ Helper.app/Contents/MacOS/Chromium\ Helper
                 U __NSGetExecutablePath
                 U __ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv
                 U __ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKc
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcm
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEmc
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_mmRKS4_
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_
                 U __ZNSt3__14stoiERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPmi
                 U __ZNSt3__19to_stringEi
                 U __ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_
                 U __ZdaPv
                 U __ZdlPv
                 U __Znam
                 U __Znwm
                 U ___bzero
                 U ___error
                 U ___stack_chk_fail
                 U ___stack_chk_guard
                 U ___stderrp
0000000100000000 T __mh_execute_header
                 U __tlv_bootstrap
                 U _abort
                 U _asl_close
                 U _asl_free
                 U _asl_new
                 U _asl_open
                 U _asl_send
                 U _asl_set
                 U _close
                 U _dirname
                 U _dlerror
                 U _dlopen
                 U _dlsym
                 U _exit
                 U _fflush
                 U _fprintf
                 U _fwrite
                 U _geteuid
                 U _getpid
0000000100000d70 T _main
                 U _memcmp
                 U _memcpy
                 U _perror
                 U _pthread_mutex_destroy
                 U _pthread_mutex_init
                 U _pthread_mutex_lock
                 U _pthread_mutex_unlock
                 U _readv
                 U _realpath$DARWIN_EXTSN
                 U _sandbox_free_error
                 U _sandbox_init_with_parameters
                 U _sched_yield
                 U _snprintf
                 U _strcmp
                 U _strerror
                 U _strlen
                 U _strncmp
                 U _vsnprintf
                 U dyld_stub_binder


After CL:
-rwxr-xr-x  2 rsesek  eng  9204 Feb 15 18:11 out/official/Chromium.app/Contents/MacOS/Chromium
-rwxr-xr-x  3 rsesek  eng  62756 Feb 15 18:10 out/official/Chromium.app/Contents/Versions/66.0.3349.0/Chromium Helper.app/Contents/MacOS/Chromium Helper

% nm out/official/Chromium.app/Contents/MacOS/Chromium
                 U __NSGetExecutablePath
                 U __ZdaPv
                 U __Znam
                 U ___error
                 U ___stderrp
                 U _abort
                 U _dirname
                 U _dlerror
                 U _dlopen
                 U _dlsym
                 U _exit
                 U _fprintf
                 U _fwrite
0000000100000c50 T _main
                 U _snprintf
                 U _strerror
                 U _strlen
                 U dyld_stub_binder
% nm out/official/Chromium.app/Contents/Versions/66.0.3349.0/Chromium\ Helper.app/Contents/MacOS/Chromium\ Helper
                 U __NSGetExecutablePath
                 U __ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv
                 U __ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKc
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcm
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEmc
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_mmRKS4_
                 U __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_
                 U __ZNSt3__14stoiERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPmi
                 U __ZNSt3__19to_stringEi
                 U __ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_
                 U __ZdaPv
                 U __ZdlPv
                 U __Znam
                 U __Znwm
                 U ___bzero
                 U ___error
                 U ___stack_chk_fail
                 U ___stack_chk_guard
                 U ___stderrp
                 U __tlv_bootstrap
                 U _abort
                 U _asl_close
                 U _asl_free
                 U _asl_new
                 U _asl_open
                 U _asl_send
                 U _asl_set
                 U _close
                 U _dirname
                 U _dlerror
                 U _dlopen
                 U _dlsym
                 U _exit
                 U _fflush
                 U _fprintf
                 U _fwrite
                 U _geteuid
                 U _getpid
0000000100000d70 T _main
                 U _memcmp
                 U _memcpy
                 U _perror
                 U _pthread_mutex_destroy
                 U _pthread_mutex_init
                 U _pthread_mutex_lock
                 U _pthread_mutex_unlock
                 U _readv
                 U _realpath$DARWIN_EXTSN
                 U _sandbox_free_error
                 U _sandbox_init_with_parameters
                 U _sched_yield
                 U _snprintf
                 U _strcmp
                 U _strerror
                 U _strlen
                 U _strncmp
                 U _vsnprintf
                 U dyld_stub_binder

So we lose __mh_execute_header in the symbol table and get a little bit smaller this way.
Project Member

Comment 8 by bugdroid1@chromium.org, Mar 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bb5e87b52c8372f654c46ea2c1c453e173c3c34f

commit bb5e87b52c8372f654c46ea2c1c453e173c3c34f
Author: Robert Sesek <rsesek@chromium.org>
Date: Sat Mar 03 02:42:10 2018

[Mac] Resolve "strip: removing global symbols from a final linked no longer supported."

Switch to using -exported_symbols_list with the specified saves file to
preserve specific global symbols. Then use the strip command to remove
all remaining local symbols. The strip command is now applied via
//build/config/mac:strip_all rather than explicitly on specific executables.

Bug:  805453 
Change-Id: I8d21b12116842eda1f9eb5c0758f52d6198a116f
Reviewed-on: https://chromium-review.googlesource.com/922987
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540725}
[modify] https://crrev.com/bb5e87b52c8372f654c46ea2c1c453e173c3c34f/build/config/mac/BUILD.gn
[modify] https://crrev.com/bb5e87b52c8372f654c46ea2c1c453e173c3c34f/chrome/BUILD.gn
[add] https://crrev.com/bb5e87b52c8372f654c46ea2c1c453e173c3c34f/chrome/app/app.exports
[delete] https://crrev.com/6836677823de13dfda5518b25eb15e24f65a86d3/chrome/app/app.saves

Is this fixed now?
Status: Fixed (was: Started)

Sign in to add a comment