Changeset 229738 in webkit


Ignore:
Timestamp:
Mar 19, 2018 8:26:15 PM (6 years ago)
Author:
mitz@apple.com
Message:

Investigate why cpu_indicator_init is used
https://bugs.webkit.org/show_bug.cgi?id=183736

Reviewed by Tim Horton.

cpu_indicator_init, which is a global initializer, was included in JavaScriptCore because
we were passing the -all_load option to the linker, causing it to bring in all members of
every static library being linked in, including the compiler runtime library. We only need
to load all members of WTF. The linker option for doing that is -force_load, and it requires
a path to the library. To support building against libWTF.a built locally as well as against
the copy that is in the SDK, we add a script build phase that palces a symbolic link to the
appropriate libWTF.a under the DerivedSources directory, and pass the path to that symlink
to the linker. Also, while cleaning up linker flags, make OTHER_LDFLAGS_HIDE_SYMBOLS less
verbose by eliminating every other -Wl, remove redundant -lobjc (libobjc is already listed
in the Link Binary With Libraries build phase), remove long-unsupported -Y,3, and stop
reexporting libobjc.

  • Configurations/JavaScriptCore.xcconfig:
  • JavaScriptCore.xcodeproj/project.pbxproj:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r229727 r229738  
     12018-03-19  Dan Bernstein  <mitz@apple.com>
     2
     3        Investigate why __cpu_indicator_init is used
     4        https://bugs.webkit.org/show_bug.cgi?id=183736
     5
     6        Reviewed by Tim Horton.
     7
     8        __cpu_indicator_init, which is a global initializer, was included in JavaScriptCore because
     9        we were passing the -all_load option to the linker, causing it to bring in all members of
     10        every static library being linked in, including the compiler runtime library. We only need
     11        to load all members of WTF. The linker option for doing that is -force_load, and it requires
     12        a path to the library. To support building against libWTF.a built locally as well as against
     13        the copy that is in the SDK, we add a script build phase that palces a symbolic link to the
     14        appropriate libWTF.a under the DerivedSources directory, and pass the path to that symlink
     15        to the linker. Also, while cleaning up linker flags, make OTHER_LDFLAGS_HIDE_SYMBOLS less
     16        verbose by eliminating every other -Wl, remove redundant -lobjc (libobjc is already listed
     17        in the Link Binary With Libraries build phase), remove long-unsupported -Y,3, and stop
     18        reexporting libobjc.
     19
     20        * Configurations/JavaScriptCore.xcconfig:
     21        * JavaScriptCore.xcodeproj/project.pbxproj:
     22
    1232018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
    224
  • trunk/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig

    r219282 r229738  
    3636
    3737// Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols.
    38 OTHER_LDFLAGS_HIDE_SYMBOLS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__ZNKSt3__18functionIFvvEEclEv -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvvEEC1EOS2_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvvEEC2EOS2_ -Wl,-unexported_symbol -Wl,__ZNKSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEEclES3_S5_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED1Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED2Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvvEED1Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvvEED2Ev -Wl,-unexported_symbol -Wl,__ZTVNSt3__117bad_function_callE -Wl,-all_load;
     38OTHER_LDFLAGS_HIDE_SYMBOLS = -Wl,-unexported_symbol,__ZTISt9bad_alloc -Wl,-unexported_symbol,__ZTISt9exception -Wl,-unexported_symbol,__ZTSSt9bad_alloc -Wl,-unexported_symbol,__ZTSSt9exception -Wl,-unexported_symbol,__ZdlPvS_ -Wl,-unexported_symbol,__ZnwmPv -Wl,-unexported_symbol,__ZNKSt3__18functionIFvvEEclEv -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEEC1EOS2_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEEC2EOS2_ -Wl,-unexported_symbol,__ZNKSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEEclES3_S5_ -Wl,-unexported_symbol,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED1Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvRN3JSC17BytecodeGeneratorEPNS1_10RegisterIDEEED2Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEED1Ev -Wl,-unexported_symbol,__ZNSt3__18functionIFvvEED2Ev -Wl,-unexported_symbol,__ZTVNSt3__117bad_function_callE;
    3939
    40 OTHER_LDFLAGS_BASE = -lobjc -Wl,-Y,3 $(OTHER_LDFLAGS_HIDE_SYMBOLS);
     40OTHER_LDFLAGS_BASE = $(OTHER_LDFLAGS_HIDE_SYMBOLS) -force_load "$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/libWTF.a";
    4141OTHER_LDFLAGS[sdk=iphone*] = $(inherited) $(OTHER_LDFLAGS_BASE);
    42 OTHER_LDFLAGS[sdk=macosx*] = $(inherited) $(OTHER_LDFLAGS_BASE) -sub_library libobjc -framework CoreServices;
     42OTHER_LDFLAGS[sdk=macosx*] = $(inherited) $(OTHER_LDFLAGS_BASE) -framework CoreServices;
    4343
    4444SECTORDER_FLAGS = $(SECTORDER_FLAGS_$(CONFIGURATION));
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r229646 r229738  
    6666                        buildPhases = (
    6767                                65FB3F6509D11E9100F49DEB /* Generate Derived Sources */,
     68                                374F95C9205F9975002BF68F /* Make libWTF.a Symbolic Link */,
    6869                        );
    6970                        dependencies = (
     
    42204221                A7FCC26C17A0B6AA00786D1A /* FTLSwitchCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLSwitchCase.h; path = ftl/FTLSwitchCase.h; sourceTree = "<group>"; };
    42214222                A7FF647A18C52E8500B55307 /* SpillRegistersMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpillRegistersMode.h; sourceTree = "<group>"; };
    4222                 A8A4748D151A8306004123FF /* libWTF.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
     4223                A8A4748D151A8306004123FF /* libWTF.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; name = libWTF.a; path = DerivedSources/JavaScriptCore/libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
    42234224                A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
    42244225                A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
     
    98939894                        shellScript = "exec ${SRCROOT}/postprocess-headers.sh";
    98949895                };
     9896                374F95C9205F9975002BF68F /* Make libWTF.a Symbolic Link */ = {
     9897                        isa = PBXShellScriptBuildPhase;
     9898                        buildActionMask = 2147483647;
     9899                        files = (
     9900                        );
     9901                        inputPaths = (
     9902                        );
     9903                        name = "Make libWTF.a Symbolic Link";
     9904                        outputPaths = (
     9905                        );
     9906                        runOnlyForDeploymentPostprocessing = 0;
     9907                        shellPath = /bin/sh;
     9908                        shellScript = "set -e\n\nif [[ -f \"${BUILT_PRODUCTS_DIR}/libWTF.a\" ]]; then\n    ln -s -f -h \"${BUILT_PRODUCTS_DIR}/libWTF.a\" \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/libWTF.a\"\nelse\n    ln -s -f -h \"${SDK_DIR}/usr/local/lib/libWTF.a\" \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore/libWTF.a\"\nfi";
     9909                };
    98959910                53B4BD091F68AF8900D2BEA3 /* Generate Unified Sources */ = {
    98969911                        isa = PBXShellScriptBuildPhase;
Note: See TracChangeset for help on using the changeset viewer.