Skip to content

Commit 489488b

Browse files
committed
gcc: default the Vita target to local-exec TLS
Design phase 1 says the main executable uses Local Exec, but nothing enforced it: for a TLS symbol defined in another translation unit gcc falls back to initial-exec, which wants a GOT entry the Vita loader never fills. Linking a newlib with its reent in TLS produced 36 R_ARM_TLS_IE32 against _tls_errno plus 15 R_ARM_TLS_LDO32, and vita-elf-create refused them. CC1_SPEC only supplies the default, so -ftls-model= on the command line still wins. Assisted-by: Claude Opus 5
1 parent 4a09004 commit 489488b

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

patches/gcc/0001-vita-target.patch

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@ diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
1515
index 30e1d6dc9..bd5f7b19c 100644
1616
--- a/gcc/config/arm/arm.h
1717
+++ b/gcc/config/arm/arm.h
18-
@@ -731,6 +731,10 @@ extern const int arm_arch_cde_coproc_bits[];
18+
@@ -87,8 +87,10 @@ extern tree arm_bf16_ptr_type_node;
19+
#undef CPP_SPEC
20+
#define CPP_SPEC "%(subtarget_cpp_spec)"
21+
22+
#ifndef CC1_SPEC
23+
-#define CC1_SPEC ""
24+
+/* The loader hands each thread its TLS block at a fixed offset from
25+
+ TPIDRURO; every model but local-exec wants a GOT it never fills. */
26+
+#define CC1_SPEC "%{!ftls-model=*:-ftls-model=local-exec}"
27+
#endif
28+
29+
/* This macro defines names of additional specifications to put in the specs
30+
@@ -731,6 +733,10 @@ extern const int arm_arch_cde_coproc_bits[];
1931
#define WCHAR_TYPE_SIZE BITS_PER_WORD
2032
#endif
2133

@@ -26,7 +38,7 @@ index 30e1d6dc9..bd5f7b19c 100644
2638
/* Sized for fixed-point types. */
2739

2840
#define SHORT_FRACT_TYPE_SIZE 8
29-
@@ -1996,7 +2000,7 @@ enum arm_auto_incmodes
41+
@@ -1996,7 +2002,7 @@ enum arm_auto_incmodes
3042
/* signed 'char' is most compatible, but RISC OS wants it unsigned.
3143
unsigned is probably best, but may break some code. */
3244
#ifndef DEFAULT_SIGNED_CHAR

0 commit comments

Comments
 (0)