Changeset 174503 in webkit


Ignore:
Timestamp:
Oct 9, 2014 8:59:06 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Ensure that inline assembly Thunk functions don't conflict with the section designations of the compiler
https://bugs.webkit.org/show_bug.cgi?id=137434

Patch by Akos Kiss <akiss@inf.u-szeged.hu> on 2014-10-09
Reviewed by Michael Saboff.

The ARM64 version of the defineUnaryDoubleOpWrapper macro in
ThunkGenerators.cpp contains inline assembly with .text assembler
directive followed by a static variable declaration. This macro gets
expanded several times afterwards, however, only during the compilation
of the first expansion does gcc insert a .data assembler directive
before the assembled version of the static variable. Thus, only the
first variable gets allocated in the .data section, all the others
remain in .text. If JavaScriptCore is built as a shared library then
this causes a segmentation fault during dynamic linking.

This patch puts a .previous directive at the end of the inline assembly
to ensure that the assumptions of the compiler about the sections are
not broken and the following variable goes to the right place.

  • jit/ThunkGenerators.cpp:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r174478 r174503  
     12014-10-09  Akos Kiss  <akiss@inf.u-szeged.hu>
     2
     3        Ensure that inline assembly Thunk functions don't conflict with the section designations of the compiler
     4        https://bugs.webkit.org/show_bug.cgi?id=137434
     5
     6        Reviewed by Michael Saboff.
     7
     8        The ARM64 version of the defineUnaryDoubleOpWrapper macro in
     9        ThunkGenerators.cpp contains inline assembly with .text assembler
     10        directive followed by a static variable declaration. This macro gets
     11        expanded several times afterwards, however, only during the compilation
     12        of the first expansion does gcc insert a .data assembler directive
     13        before the assembled version of the static variable. Thus, only the
     14        first variable gets allocated in the .data section, all the others
     15        remain in .text. If JavaScriptCore is built as a shared library then
     16        this causes a segmentation fault during dynamic linking.
     17
     18        This patch puts a .previous directive at the end of the inline assembly
     19        to ensure that the assumptions of the compiler about the sections are
     20        not broken and the following variable goes to the right place.
     21
     22        * jit/ThunkGenerators.cpp:
     23
    1242014-10-08  Oliver Hunt  <oliver@apple.com>
    225
  • trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp

    r172759 r174503  
    802802        SYMBOL_STRING(function##Thunk) ":" "\n" \
    803803        "b " GLOBAL_REFERENCE(function) "\n" \
     804        ".previous" \
    804805    ); \
    805806    extern "C" { \
Note: See TracChangeset for help on using the changeset viewer.