Skip to content

Commit

Permalink
[JSC] Put all offlineasm code under __TEXT,__jsc_int
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=267027
rdar://120403072

Reviewed by Michael Saboff.

This patch places all offlineasm code under __TEXT,__jsc_int.
This makes it easy to determine whether the code is in the interpreter, effectively
prohibiting some of optimizations (including reordering of functions) by linkers.

* Source/JavaScriptCore/llint/LowLevelInterpreter.cpp:
* Source/JavaScriptCore/offlineasm/arm.rb:

Canonical link: https://commits.webkit.org/272611@main
  • Loading branch information
Constellation committed Jan 3, 2024
1 parent 445f16f commit 3bef04c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,15 @@ JSValue CLoop::execute(OpcodeID entryOpcodeID, void* executableAddress, VM* vm,
#define OFFLINE_ASM_ALT_ENTRY_DIRECTIVE(label)
#endif

#if OS(DARWIN)
#define OFFLINE_ASM_TEXT_SECTION ".section __TEXT,__jsc_int,regular,pure_instructions\n"
#else
#define OFFLINE_ASM_TEXT_SECTION ".text\n"
#endif

#if CPU(ARM_THUMB2)
#define OFFLINE_ASM_GLOBAL_LABEL_IMPL(label, ALT_ENTRY, ALIGNMENT) \
".text\n" \
OFFLINE_ASM_TEXT_SECTION \
ALIGNMENT \
ALT_ENTRY(label) \
".globl " SYMBOL_STRING(label) "\n" \
Expand All @@ -558,15 +564,15 @@ JSValue CLoop::execute(OpcodeID entryOpcodeID, void* executableAddress, VM* vm,
SYMBOL_STRING(label) ":\n"
#elif CPU(ARM64)
#define OFFLINE_ASM_GLOBAL_LABEL_IMPL(label, ALT_ENTRY, ALIGNMENT) \
".text\n" \
OFFLINE_ASM_TEXT_SECTION \
ALIGNMENT \
ALT_ENTRY(label) \
".globl " SYMBOL_STRING(label) "\n" \
HIDE_SYMBOL(label) "\n" \
SYMBOL_STRING(label) ":\n"
#else
#define OFFLINE_ASM_GLOBAL_LABEL_IMPL(label, ALT_ENTRY, ALIGNMENT) \
".text\n" \
OFFLINE_ASM_TEXT_SECTION \
ALT_ENTRY(label) \
".globl " SYMBOL_STRING(label) "\n" \
HIDE_SYMBOL(label) "\n" \
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/offlineasm/arm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ def lowerARMCommon
$asm.puts ".indirect_symbol #{operands[0].asmLabel}"
$asm.puts ".long 0"

$asm.puts ".text"
$asm.puts "OFFLINE_ASM_TEXT_SECTION"
$asm.puts ".align 4"

$asm.putStr("#elif OS(LINUX)")
Expand Down

0 comments on commit 3bef04c

Please sign in to comment.