small c file:
typedef int G; __thread G *g __asm__("" "runtime.g"); G* runtime_g(void) __attribute__ ((noinline, no_split_stack)); G* runtime_g(void) { return g; }
during compilation using genode-x86-gcc 10.3 error in asm (and checked genode-x86-as as well): tt1.s: Assembler messages: tt1.s:22: Error: junk at end of line, first unrecognized character is `*' tt1.s:25: Error: unrecognized symbol type "" tt1.s:25: Error: junk at end of line, first unrecognized character is `*' tt1.s:26: Error: expected comma after name `__emutls_v.' in .size directive tt1.s:27: Error: invalid character '*' in mnemonic tt1.s:13: Error: invalid operands (*UND* and *UND* sections) for `*’
generated asm: .file "tt1.c" .text .globl runtime_g .type runtime_g, @function runtime_g: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $__emutls_v.*runtime.g, %edi call __emutls_get_address movq (%rax), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size runtime_g, .-runtime_g .globl __emutls_v.*runtime.g ^^^^^^^ first error line ^^^^^^^^^^^^^^^^^ .data .align 32 .type __emutls_v.*runtime.g, @object .size __emutls_v.*runtime.g, 32 __emutls_v.*runtime.g: .quad 8 .quad 8 .quad 0 .quad 0 .ident "GCC: (GNU) 10.3.0"
found that key problem here is
__thread G *g __asm__("" "runtime.g»);
in form of
__thread G *g ;
it works, so, question - how to use this asm synonym for __thread variables in 10.3?
9 июня 2021 г., в 17:01, Alexander Tormasov via users users@lists.genode.org написал(а):
small c file:
typedef int G; __thread G *g __asm__("" "runtime.g"); G* runtime_g(void) __attribute__ ((noinline, no_split_stack)); G* runtime_g(void) { return g; }
during compilation using genode-x86-gcc 10.3 error in asm (and checked genode-x86-as as well): tt1.s: Assembler messages: tt1.s:22: Error: junk at end of line, first unrecognized character is `*' tt1.s:25: Error: unrecognized symbol type "" tt1.s:25: Error: junk at end of line, first unrecognized character is `*' tt1.s:26: Error: expected comma after name `__emutls_v.' in .size directive tt1.s:27: Error: invalid character '*' in mnemonic tt1.s:13: Error: invalid operands (*UND* and *UND* sections) for `*’
generated asm: .file "tt1.c" .text .globl runtime_g .type runtime_g, @function runtime_g: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $__emutls_v.*runtime.g, %edi call __emutls_get_address movq (%rax), %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size runtime_g, .-runtime_g .globl __emutls_v.*runtime.g ^^^^^^^ first error line ^^^^^^^^^^^^^^^^^ .data .align 32 .type __emutls_v.*runtime.g, @object .size __emutls_v.*runtime.g, 32 __emutls_v.*runtime.g: .quad 8 .quad 8 .quad 0 .quad 0 .ident "GCC: (GNU) 10.3.0"
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users
Hello Alexander,
On Wed, Jun 09, 2021 at 16:45:17 CEST, Alexander Tormasov via users wrote:
found that key problem here is
__thread G *g __asm__("" "runtime.g»);
in form of
__thread G *g ;
it works, so, question - how to use this asm synonym for __thread variables in 10.3?
Do you also see this error with a Linux-native GCC 10 tool chain?
BTW, may the GCC community (or even Stackoverflow) be a much better place to ask this general question than this mailing list? I doubt we have to offer many GCC experts in the Genode crowd.
Greets
Hello Christian,
On Wed, Jun 09, 2021 at 16:45:17 CEST, Alexander Tormasov via users wrote:
found that key problem here is
__thread G *g __asm__("" "runtime.g»);
in form of
__thread G *g ;
it works, so, question - how to use this asm synonym for __thread variables in 10.3?
Do you also see this error with a Linux-native GCC 10 tool chain?
No, I checked both 9 and 10 they generate something like .file "t.c" .text .globl runtime.g .section .tbss,"awT",@nobits .align 8 .type runtime.g, @object .size runtime.g, 8 runtime.g: .zero 8 .text .globl runtime_g .type runtime_g, @function runtime_g: .LFB0: .cfi_startproc endbr64 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %fs:runtime.g@tpoff, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size runtime_g, .-runtime_g …
While genode build toolchain generate wrong asm, see previous letter - instead of movq %fs:runtime.g@tpoff, %rax it generate syntactically incorrect name for runtime.g
movl $__emutls_v.*runtime.g, %edi call __emutls_get_address
seems that this is genode - build specific problem...
BTW, may the GCC community (or even Stackoverflow) be a much better place to ask this general question than this mailing list? I doubt we have to offer many GCC experts in the Genode crowd.
may be -while, as you see, this is not gcc bug. And I hope that you already encounter something like this before, during port to 10.3 of current code base
Sincerely, Alexander
Hi Alexander,
On 09.06.21 16:01, Alexander Tormasov via users wrote:
small c file:
typedef int G; __thread G *g __asm__("" "runtime.g"); G* runtime_g(void) __attribute__ ((noinline, no_split_stack)); G* runtime_g(void) { return g; }
during compilation using genode-x86-gcc 10.3 error in asm (and checked genode-x86-as as well): tt1.s: Assembler messages: tt1.s:22: Error: junk at end of line, first unrecognized character is `*' tt1.s:25: Error: unrecognized symbol type "" tt1.s:25: Error: junk at end of line, first unrecognized character is `*' tt1.s:26: Error: expected comma after name `__emutls_v.' in .size directive tt1.s:27: Error: invalid character '*' in mnemonic tt1.s:13: Error: invalid operands (*UND* and *UND* sections) for `*’
I tried to compile your test program with the 19.05 Genode tool chain and got the same error. Does it happen only with gcc 10.3 for you?
Christian
Hi Christian,
I tried to compile your test program with the 19.05 Genode tool chain and got the same error. Does it happen only with gcc 10.3 for you?
hm, this is the code from gccgo libgo version 10.3 for older related to 19.5 (gcc 8.3) may be the code do not contain it, need to check more carefully…
will try to check later today
Sincerely, Alexander
found this change is the 10.3 libgo code vs 8.3: -static __thread G *g; +__thread G *g __asm__(GOSYM_PREFIX "runtime.g");
so, this appears only recently and the bug is older than I think before
10 июня 2021 г., в 20:21, Alexander Tormasov via users users@lists.genode.org написал(а):
Hi Christian,
I tried to compile your test program with the 19.05 Genode tool chain and got the same error. Does it happen only with gcc 10.3 for you?
hm, this is the code from gccgo libgo version 10.3 for older related to 19.5 (gcc 8.3) may be the code do not contain it, need to check more carefully…
will try to check later today
Sincerely, Alexander _______________________________________________ Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users
Alexander,
On Thu, Jun 10, 2021 at 19:29:49 CEST, Alexander Tormasov via users wrote:
found this change is the 10.3 libgo code vs 8.3: -static __thread G *g; +__thread G *g __asm__(GOSYM_PREFIX "runtime.g");
so, this appears only recently and the bug is older than I think before
I'm still certain this is a GCC bug as it bluntly generates invalid assembler code if the tool chain is build to use emutls as we do in Genode's tool_chain script. The way I see it noone else tries to use libgo (or other code that combines 'thread_local' with 'asm("asm_symbol") in combination with emutls.
Regards