Avoid privatization of TLS variables
Jan Hubicka
hubicka@ucw.cz
Thu Sep 25 01:58:00 GMT 2014
>
> I'm not sure because my line numbers don't match. If it is this
> assert:
>
> case elfcpp::R_X86_64_TPOFF32: // Local-exec
> if (tls_segment == NULL)
> {
> gold_assert(parameters->errors()->error_count() > 0
> || issue_undefined_symbol_error(gsym));
> return;
> }
> value -= tls_segment->memsz();
> Relocate_functions<size, false>::rela32(view, value, addend);
> break;
I looked it up and it was the place I got ICE, too.
>
> then the problem is that there is a TPOFF32 relocation but none of the
> input files has a section with the SHF_TLS flag set. This should not
> be possible--the TPOFF32 relocation implies a TLS variable, but the
> absence of any SHF_TLS sections implies that there are no TLS
> variables.
I get:
a.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <main>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 64 48 8b 04 25 00 00 mov %fs:0x0,%rax
b: 00 00
9: R_X86_64_TPOFF32 __gcov_indirect_call_counters_ltopriv
d: 64 48 8b 14 25 00 00 mov %fs:0x0,%rdx
14: 00 00
12: R_X86_64_TPOFF32 __gcov_indirect_call_callee_ltopriv
16: 48 89 d1 mov %rdx,%rcx
19: ba 00 00 00 00 mov $0x0,%edx
1a: R_X86_64_32 main
1e: be eb 72 70 06 mov $0x67072eb,%esi
23: 48 89 c7 mov %rax,%rdi
26: e8 00 00 00 00 callq 2b <main+0x2b>
27: R_X86_64_PC32 __gcov_indirect_call_profiler+0xfffffffffffffffc
2b: 64 48 c7 04 25 00 00 movq $0x0,%fs:0x0
32: 00 00 00 00 00 00
30: R_X86_64_TPOFF32 __gcov_indirect_call_callee_ltopriv
38: bf 00 00 00 00 mov $0x0,%edi
39: R_X86_64_32 .bss+0x8
3d: e8 00 00 00 00 callq 42 <main+0x42>
3e: R_X86_64_PC32 __gcov_time_profiler+0xfffffffffffffffc
42: ba 00 00 00 00 mov $0x0,%edx
47: 48 8b 05 00 00 00 00 mov 0x0(%rip),%rax # 4e <main+0x4e>
4a: R_X86_64_PC32 .bss+0xfffffffffffffffc
4e: 48 83 c0 01 add $0x1,%rax
52: 48 89 05 00 00 00 00 mov %rax,0x0(%rip) # 59 <main+0x59>
55: R_X86_64_PC32 .bss+0xfffffffffffffffc
59: 89 d0 mov %edx,%eax
5b: 5d pop %rbp
5c: c3 retq
000000000000005d <_GLOBAL__sub_I_65535_0_main>:
5d: 55 push %rbp
5e: 48 89 e5 mov %rsp,%rbp
61: bf 00 00 00 00 mov $0x0,%edi
62: R_X86_64_32 .data+0x40
66: e8 00 00 00 00 callq 6b <_GLOBAL__sub_I_65535_0_main+0xe>
67: R_X86_64_PC32 __gcov_init+0xfffffffffffffffc
6b: 5d pop %rbp
6c: c3 retq
and in asm:
.file "ccstYwxO.ltrans0.o"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq %fs:__gcov_indirect_call_counters_ltopriv@tpoff, %rax
movq %fs:__gcov_indirect_call_callee_ltopriv@tpoff, %rdx
movq %rdx, %rcx
movl $main, %edx
movl $108032747, %esi
movq %rax, %rdi
call __gcov_indirect_call_profiler
movq $0, %fs:__gcov_indirect_call_callee_ltopriv@tpoff
movl $__gcov8.main, %edi
call __gcov_time_profiler
movl $0, %edx
movq __gcov0.main(%rip), %rax
addq $1, %rax
movq %rax, __gcov0.main(%rip)
movl %edx, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.hidden __gcov_indirect_call_callee_ltopriv
.tls_common __gcov_indirect_call_callee_ltopriv,8,8
.hidden __gcov_indirect_call_counters_ltopriv
.tls_common __gcov_indirect_call_counters_ltopriv,8,8
.local __gcov0.main
.comm __gcov0.main,8,8
.local __gcov8.main
.comm __gcov8.main,8,8
.type _GLOBAL__sub_I_65535_0_main, @function
...
Honza
>
> Why would there be a TPOFF32 relocation in the simple test case from
> Markus?
>
> If that is not the assertion, let me know what is.
>
> Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.o
Type: application/x-object
Size: 3064 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140925/3b10cd17/attachment.bin>
More information about the Gcc-patches
mailing list