New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 596918 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit 26 days ago
Closed: Mar 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

enable_profiling broken on Linux?

Project Member Reported by cbiesin...@chromium.org, Mar 22 2016

Issue description

I tried to compile a build with enable_profiling but failed in NaCl:

[38221/39784] LINK newlib_pnacl_nonsfi/nacl_helper_nonsfi_unittests_main
FAILED: python "../../build/toolchain/gcc_link_wrapper.py" --strip="../../native_client/toolchain/linux_x86/pnacl_newlib/bin/pnacl-strip" --unstripped-file="newlib_pnacl_nonsfi/exe.unstripped/nacl_helper_nonsfi_unittests_main" --output="newlib_pnacl_nonsfi/nacl_helper_nonsfi_unittests_main" -- ../../native_client/toolchain/linux_x86/pnacl_newlib/bin/pnacl-clang++ -Wl,--fatal-warnings --pnacl-allow-translate --pnacl-allow-native -Wl,--noirt -Wt,--noirt -Wt,--noirtshim -nodefaultlibs -arch x86-32-nonsfi --target=i686-unknown-nacl -Wl,-O1 -Wl,--gc-sections -Wl,--as-needed -o "newlib_pnacl_nonsfi/exe.unstripped/nacl_helper_nonsfi_unittests_main" -Wl,--start-group @"newlib_pnacl_nonsfi/nacl_helper_nonsfi_unittests_main.rsp"  -Wl,--end-group  -lc++ -lm -lc -lpnaclmm 
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilingIsEnabledForAllThreads'
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilerStop'
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilerStart'
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilerRegisterThread'
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilerFlush'
[38221/39784] LINK newlib_pnacl_nonsfi/nacl_helper_nonsfi
FAILED: python "../../build/toolchain/gcc_link_wrapper.py" --strip="../../native_client/toolchain/linux_x86/pnacl_newlib/bin/pnacl-strip" --unstripped-file="newlib_pnacl_nonsfi/exe.unstripped/nacl_helper_nonsfi" --output="newlib_pnacl_nonsfi/nacl_helper_nonsfi" -- ../../native_client/toolchain/linux_x86/pnacl_newlib/bin/pnacl-clang++ -Wl,--fatal-warnings --pnacl-allow-translate --pnacl-allow-native -Wl,--noirt -Wt,--noirt -Wt,--noirtshim -nodefaultlibs -arch x86-32-nonsfi --target=i686-unknown-nacl -Wl,-O1 -Wl,--gc-sections -Wl,--as-needed -o "newlib_pnacl_nonsfi/exe.unstripped/nacl_helper_nonsfi" -Wl,--start-group @"newlib_pnacl_nonsfi/nacl_helper_nonsfi.rsp"  -Wl,--end-group  -lc++ -lm -lc -lpnaclmm 
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilingIsEnabledForAllThreads'
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilerStop'
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilerStart'
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilerRegisterThread'
newlib_pnacl_nonsfi/obj/base/base/profiler.o: error: undefined reference to 'ProfilerFlush'


My config:
$ cat out/Releasegn/args.gn 
# Build arguments go here. Examples:
#   is_component_build = true
#   is_debug = false
# See "gn args <out_dir> --list" for available build arguments.

is_component_build = false # otherwise profiling won't link
is_debug = false
enable_profiling = true
use_goma = true

tree as of today:
$ git log | head
commit 6d31c52edc9c6d20419b6fe12f66c60548ab7142
Author: asvitkine <asvitkine@chromium.org>
Date:   Tue Mar 22 11:37:52 2016


 
Cc: brettw@chromium.org mcgrathr@chromium.org
Cc: phosek@chromium.org
Labels: OS-Linux
Owner: mcgrathr@chromium.org
Status: Started (was: Untriaged)
It seems to me the root cause is BUILD.gn files thinking that tcmalloc will be used, though in the newlib_pnacl_nonsfi toolchain (and AFAICT in all NaCl toolchains), in fact tcmalloc is never used.

It seems to me more proper to make sure the use_allocator value is never "tcmalloc" in a NaCl toolchain context, rather than to have dependent options like enable_profiling directly forced off in NaCl toolchain contexts.  I have a fix along those lines I'll post shortly.

Project Member

Comment 3 by bugdroid1@chromium.org, Mar 27 2016

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

commit ee80d85ca30c60a5167ef6849157918bc01d757c
Author: mcgrathr <mcgrathr@chromium.org>
Date: Sun Mar 27 20:19:00 2016

GN: Force use_allocator="none" in NaCl toolchains

Heretofore, the use_allocator build argument has been effectively
ignored within NaCl toolchains by dint of the 'if (!is_nacl)'
around the contents of //base/allocator:allocator.  However,
configs that test the use_allocator value have not had equivalent
is_nacl exceptions.  The result is that tcmalloc is never built
in NaCl toolchains but other parts of the code think it has been.
Notably, //build/config:feature_flags fails to #define
NO_TCMALLOC.  Hence, code testing NO_TCMALLOC wrongly concludes
it can call entry points supplied by tcmalloc.  This broke the
enable_profiling=true build of some targets in the
newlib_pnacl_nonsfi toolchain, because //base/debug/profiler.cc
tries to use profiling-related tcmalloc entry points.

So this change removes that is_nacl kludge from //base/allocator
and instead wires up NaCl toolchains to force a setting of
use_allocator="none" via toolchain_args().

BUG=  596918 
R=dpranke@chromium.org, phosek@chromium.org

Review URL: https://codereview.chromium.org/1835433002

Cr-Commit-Position: refs/heads/master@{#383471}

[modify] https://crrev.com/ee80d85ca30c60a5167ef6849157918bc01d757c/base/allocator/BUILD.gn
[modify] https://crrev.com/ee80d85ca30c60a5167ef6849157918bc01d757c/build/toolchain/gcc_toolchain.gni
[modify] https://crrev.com/ee80d85ca30c60a5167ef6849157918bc01d757c/build/toolchain/nacl_toolchain.gni

Status: Fixed (was: Started)

Sign in to add a comment