summaryrefslogtreecommitdiffstats
path: root/libs/wpewebkit/patches/124-JavaScriptCore-RISCV64-LLInt-arch-attribute-once.patch
blob: c20b1091e94363b7dfd57b8a5b0907461ac071c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From afd3de668f477485f996f4581cec8c723390da14 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Wed, 23 Sep 2026 14:33:27 +0100
Subject: [PATCH] JavaScriptCore: emit the RISCV64 LLInt arch attribute only
 once

The RISCV64 variant of OFFLINE_ASM_GLOBAL_LABEL_IMPL emits a
'.attribute arch, "rv64gc"' directive for every global label in the
generated LLInt assembly. The whole LLInt is emitted as a single
top-level __asm__ block, so from the second label onwards the
directive appears after instructions have already been emitted, and
recent binutils rejects it:

  {standard input}: Fatal error: architecture elf attributes must
  set before any instructions

The ELF architecture attribute is already emitted once for the
translation unit by the compiler from -march=rv64gc, which equally
covers the rv64gc instructions in the LLInt asm. Drop the RISCV64
special case so the generic OFFLINE_ASM_GLOBAL_LABEL_IMPL is used,
which does not emit the redundant per-label directive.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 Source/JavaScriptCore/llint/LowLevelInterpreter.cpp | 9 ---------
 1 file changed, 9 deletions(-)

--- a/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
+++ b/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp
@@ -573,15 +573,6 @@ WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
     ".thumb\n"                                   \
     ".thumb_func " THUMB_FUNC_PARAM(label) "\n"  \
     SYMBOL_STRING(label) ":\n"
-#elif CPU(RISCV64)
-#define OFFLINE_ASM_GLOBAL_LABEL_IMPL(label, ALT_ENTRY, ALIGNMENT, VISIBILITY) \
-    OFFLINE_ASM_TEXT_SECTION                    \
-    ALIGNMENT                                   \
-    ALT_ENTRY(label)                            \
-    ".globl " SYMBOL_STRING(label) "\n"         \
-    ".attribute arch, \"rv64gc\"" "\n"          \
-    VISIBILITY(label) "\n"                      \
-    SYMBOL_STRING(label) ":\n"
 #else
 #define OFFLINE_ASM_GLOBAL_LABEL_IMPL(label, ALT_ENTRY, ALIGNMENT, VISIBILITY) \
     OFFLINE_ASM_TEXT_SECTION                    \