Skip to content

Commit

Permalink
Merge r174503 - Ensure that inline assembly Thunk functions don't con…
Browse files Browse the repository at this point in the history
…flict 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:

Canonical link: https://commits.webkit.org/154760.114@webkitgtk/2.6
git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@174966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
akosthekiss authored and carlosgcampos committed Oct 21, 2014
1 parent 879e935 commit 838bd6b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,26 @@
2014-10-09 Akos Kiss <akiss@inf.u-szeged.hu>

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

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:

2014-10-06 Oliver Hunt <oliver@apple.com>

Fix cloop build
Expand Down
1 change: 1 addition & 0 deletions Source/JavaScriptCore/jit/ThunkGenerators.cpp
Expand Up @@ -801,6 +801,7 @@ double jsRound(double d)
HIDE_SYMBOL(function##Thunk) "\n" \
SYMBOL_STRING(function##Thunk) ":" "\n" \
"b " GLOBAL_REFERENCE(function) "\n" \
".previous" \
); \
extern "C" { \
MathThunkCallingConvention function##Thunk(MathThunkCallingConvention); \
Expand Down

0 comments on commit 838bd6b

Please sign in to comment.