[PATCH] D58336: [X86] Fix tls variable lowering issue with large code model

LuoYuanke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 20 17:37:11 PST 2019


LuoYuanke marked an inline comment as done.
LuoYuanke added inline comments.


================
Comment at: test/CodeGen/X86/code-model-elf.ll:411
+; LARGE-PIC:       # %bb.0:
+; LARGE-PIC-NEXT:    movq    thread_data at GOTTPOFF(%rip), %rax
+; LARGE-PIC-NEXT:    movl    %fs:(%rax), %eax
----------------
rnk wrote:
> Wouldn't this load need to be through the PIC register?
Seems no, because in the test case, it specify the pie option "!2 = !{i32 7, !"PIE Level", i32 2}". We can generate the same result with gcc.

bash-4.2$ cat t.c
extern __thread int x;
int f(void) { return x; }


bash-4.2$ gcc -S -fpic -fpie t.c -mcmodel=large -o -
        .file   "t.c"
        .text
        .globl  f
        .type   f, @function
f:
.LFB0:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        movq    x at gottpoff(%rip), %rax
        movl    %fs:(%rax), %eax
        popq    %rbp
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE0:
        .size   f, .-f
        .ident  "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-16)"
        .section        .note.GNU-stack,"", at progbits


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58336/new/

https://reviews.llvm.org/D58336





More information about the llvm-commits mailing list