-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LLD] [COFF] Mark the symbol _tls_used as a GC root (#71336)
This is necessary if the object file containing _tls_used is built with -fdata-sections; if this symbol is present, lld is going to include references to it in the PE header, in the TLS_TABLE data directory. Therefore, treat the symbol as a GC root, i.e. retain it (and whatever other symbols the section chunk references) when doing doing GC (/opt:ref), if the symbol is present.
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# REQUIRES: x86 | ||
# RUN: llvm-mc -triple=x86_64-windows-gnu -filetype=obj -o %t.obj %s | ||
# RUN: lld-link %t.obj /out:%t.exe /entry:main /subsystem:console /opt:ref | ||
# RUN: llvm-readobj --file-headers %t.exe | FileCheck %s | ||
|
||
# CHECK: TLSTableRVA: 0x1000 | ||
# CHECK: TLSTableSize: 0x28 | ||
|
||
.section .text@main,"xr",one_only,main | ||
.globl main | ||
main: | ||
ret | ||
|
||
.section .tls$aaa | ||
tlsvar: | ||
.long 1 | ||
|
||
.section .rdata$_tls_used,"dr",one_only,_tls_used | ||
.globl _tls_used | ||
_tls_used: | ||
.zero 40 |