[llvm-bugs] [Bug 45598] New: TLS variables in inline assembly not considered TLS variables

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Apr 18 09:13:27 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45598

            Bug ID: 45598
           Summary: TLS variables in inline assembly not considered TLS
                    variables
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: yshuiv7 at gmail.com
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

Input file 1:

target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

%struct._glapi_table = type opaque

@table_noop_array = external constant [0 x void ()*], align 8
@_glapi_tls_Dispatch = thread_local(initialexec) local_unnamed_addr global
%struct._glapi_table* bitcast ([0 x void ()*]* @table_noop_array to
%struct._glapi_table*), align 8

; Function Attrs: norecurse nounwind readonly sspstrong uwtable
define %struct._glapi_table* @_glapi_get_dispatch() local_unnamed_addr #2 {
  %1 = load %struct._glapi_table*, %struct._glapi_table** @_glapi_tls_Dispatch,
align 8
  ret %struct._glapi_table* %1
}

Input file 2:

target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

module asm ".text"
module asm ".balign 32"
module asm "x86_64_entry_start:"
module asm ".hidden shared_dispatch_stub_0"
module asm ".globl shared_dispatch_stub_0"
module asm ".type shared_dispatch_stub_0, @function"
module asm ".balign 32"
module asm "shared_dispatch_stub_0:"
module asm "\09movq _glapi_tls_Dispatch at GOTTPOFF(%rip), %rax"
module asm "\09movq %fs:(%rax), %r11"
module asm "\09jmp *(8 * 0)(%r11)"

@x86_64_entry_start = external hidden global [0 x i8], align 1


lld complains:

ld.lld: error: TLS attribute mismatch: _glapi_tls_Dispatch

Looks like _glapi_tls_Dispatch in input file 2 is not considered a TLS
variable, presumably because it's defined in inline assembly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200418/81983985/attachment.html>


More information about the llvm-bugs mailing list