-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Commit 2fb37bd
cmd/link,cmd/compile: add -tls flag for TLS model control
Add -tls flag to control Thread Local Storage model selection with
options: auto, LE (Local Exec), IE (Initial Exec), GD (General Dynamic).
Default behavior selects GD for c-shared/c-archive builds on Unix
platforms to enable dlopen() compatibility with non-glibc systems.
Validates TLS model selection to prevent invalid combinations such as
LE with shared libraries. Updates all architectures (x86, ARM64, ARM,
PowerPC64, s390x, RISC-V, LoongArch64, MIPS) to use centralized TLS
model selection logic through ShouldUseTLSGD() and ShouldUseTLSLE()
helper functions.
Also fixes missing variable declaration in runtime/os_linux.go that
was causing build failures.
Fixes #13492
Co-Authored-By: Alexander Musman <alexander.musman@gmail.com>1 parent f42e695 commit 2fb37bd
File tree
17 files changed
+213
-47
lines changed- src
- cmd
- compile/internal/base
- internal/obj
- arm64
- arm
- loong64
- mips
- ppc64
- riscv
- s390x
- x86
- link/internal/ld
- runtime
- testdata
17 files changed
+213
-47
lines changedLines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
122 | + | ||
122 | 123 |
| |
123 | 124 |
| |
124 | 125 |
| |
| |||
292 | 293 |
| |
293 | 294 |
| |
294 | 295 |
| |
296 | + | ||
297 | + | ||
298 | + | ||
299 | + | ||
300 | + | ||
295 | 301 |
| |
296 | 302 |
| |
297 | 303 |
| |
| |||
568 | 574 |
| |
569 | 575 |
| |
570 | 576 |
| |
577 | + | ||
578 | + | ||
579 | + | ||
580 | + | ||
581 | + | ||
582 | + | ||
583 | + | ||
584 | + | ||
585 | + | ||
586 | + | ||
587 | + | ||
588 | + | ||
589 | + | ||
590 | + | ||
591 | + | ||
592 | + | ||
593 | + | ||
594 | + | ||
595 | + | ||
596 | + | ||
597 | + | ||
571 | 598 |
| |
572 | 599 |
| |
573 | 600 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
871 | 871 |
| |
872 | 872 |
| |
873 | 873 |
| |
874 | - | ||
874 | + | ||
875 | 875 |
| |
876 | 876 |
| |
877 | 877 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2103 | 2103 |
| |
2104 | 2104 |
| |
2105 | 2105 |
| |
2106 | - | ||
2106 | + | ||
2107 | 2107 |
| |
2108 | 2108 |
| |
2109 | 2109 |
| |
|
Lines changed: 42 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | + | ||
48 | 89 |
| |
49 | 90 |
| |
50 | 91 |
| |
| |||
1147 | 1188 |
| |
1148 | 1189 |
| |
1149 | 1190 |
| |
1191 | + | ||
1150 | 1192 |
| |
1151 | 1193 |
| |
1152 | 1194 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
763 | 763 |
| |
764 | 764 |
| |
765 | 765 |
| |
766 | - | ||
766 | + | ||
767 | 767 |
| |
768 | 768 |
| |
769 | 769 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
610 | 610 |
| |
611 | 611 |
| |
612 | 612 |
| |
613 | - | ||
613 | + | ||
614 | 614 |
| |
615 | 615 |
| |
616 | 616 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
910 | 910 |
| |
911 | 911 |
| |
912 | 912 |
| |
913 | - | ||
913 | + | ||
914 | 914 |
| |
915 | 915 |
| |
916 | 916 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3904 | 3904 |
| |
3905 | 3905 |
| |
3906 | 3906 |
| |
3907 | - | ||
3907 | + | ||
3908 | 3908 |
| |
3909 | 3909 |
| |
3910 | 3910 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
582 | 582 |
| |
583 | 583 |
| |
584 | 584 |
| |
585 | - | ||
585 | + | ||
586 | 586 |
| |
587 | 587 |
| |
588 | 588 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 | + | ||
60 | 61 |
| |
61 | 62 |
| |
62 | 63 |
| |
|
0 commit comments