• asharif@chromium.org's avatar
    Added compile-time define to gate "initial-exec" attribute. · fde23027
    asharif@chromium.org authored
    The "initial-exec" attribute is added to the ThreadCache::threadlocal_heap_
    variable under normal compilation. This causes the linker to emit a
    R_X86_64_TPOFF64 relocation in the _pyautolib.so shared object. This relocation
    can cause python to error with:
    
    cannot allocate memory in static TLS block
    
    when it calls dlopen() on _pyautolib.so (when the import statement is
    interpreted).
    
    This only happens when the TLS section is large enough. Building Chrome with
    -fprofile-generate to add some instrumentation-related data to the TLS is enough
    to trigger this condition.
    
    This CL encloses the function attribute in #if ! defined(PGO_GENERATE). When
    Chrome is built with -fprofile-generate, we will also pass in -DPGO_GENERATE and
    -ftls-model=global-dynamic so profile data can be collected without any errors.
    
    BUG=none
    TEST=Rebuilt chromeos-chrome in the chroot with -fprofile-generate
    -ftls-model=global-dynamic -DPGO_GENERATE && ran pyautoperf autotests.
    
    
    Review URL: http://codereview.chromium.org/10035012
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133810 0039d316-1c4b-4281-b951-d872f2087c98
    fde23027
thread_cache.h 15.4 KB