https://sourceware.org/bugzilla/show_bug.cgi?id=32123

            Bug ID: 32123
           Summary: Linker should check all invalid @TLSCALL usage
           Product: binutils
           Version: 2.44 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: i386,x86_64

"call *ld@TLSCALL(%rax)" calls _dl_tlsdesc_return which expects that
RAX points to the TLS descriptor.  Linker issues an error when there
is TLS transition, but doesn't when there is no TLS transition:

[hjl@gnu-cfl-3 tls-2]$  cat x.S
        .text
        .p2align 4
        .globl  get_ld
        .type   get_ld, @function
get_ld:
.LFB0:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        leaq    ld@TLSDESC(%rip), %rcx
        call    *ld@TLSCALL(%rcx)
        addq    %fs:0, %rax
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE0:
        .size   get_ld, .-get_ld
        .section .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-3 tls-2]$ gcc -c x.S
[hjl@gnu-cfl-3 tls-2]$ ld -shared x.o
[hjl@gnu-cfl-3 tls-2]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to