[v2,1/3] elf: Replace .tls_common with .tbss definition [BZ #28152]

Message ID 20210805162601.1200851-2-maskray@google.com
State Committed
Headers
Series Allow LLD 13.0.0 and improve compatibility with gold and clang |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Fangrui Song Aug. 5, 2021, 4:25 p.m. UTC
  .tls_common is obsoleted, not supported by clang -fintegrated-as or ld.lld.
Just change it to .tbss for portability.
---
 elf/tls-macros.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/elf/tls-macros.h b/elf/tls-macros.h
index e25e33b0f0..a637407417 100644
--- a/elf/tls-macros.h
+++ b/elf/tls-macros.h
@@ -1,7 +1,11 @@ 
 /* Macros to support TLS testing in times of missing compiler support.  */
 
 #define COMMON_INT_DEF(x) \
-  asm (".tls_common " #x ",4,4")
+  asm (".section .tbss\n\t" \
+       ".globl " #x "\n\t" \
+       ".balign 4\n\t" \
+       #x ":\t.space 4\n\t" \
+       ".previous")
 /* XXX Until we get compiler support we don't need declarations.  */
 #define COMMON_INT_DECL(x)