On Fri, Apr 19, 2024, at 15:59, Chenguang Wang wrote:
> This reverts commit 4bc4c9584a13736c20855cdea2203d3bd0a259a3.>> We can re-enable BTI now, since the stock `as` in OpenBSD 7.5 seems to> support it:>> qbe $ ./qbe test/tls.ssa > /tmp/tls.s> qbe $ grep endbr64 /tmp/tls.s | uniq -c> 6 endbr64> qbe $ as /tmp/tls.s -o /tmp/tls.o> qbe $ ls -al /tmp/tls.o> -rw-r--r-- 1 w wheel 2312 Apr 19 06:57 /tmp/tls.o>> isel4.ssa and tls.ssa currently fail with SIGILL on my machine. This> commit fixes that.
Hi, do you think we could use .cfi_startproc uniformly across
all targets and let the assembler emit the right instructions?
I don't think so:
qbe $ ./qbe test/tls.ssa | tail -n17
.text
xvalcnt:
.cfi_startproc
pushq %rbp
movq %rsp, %rbp
movq %fs:0, %rax
leaq x@tpoff(%rax), %rax
movl (%rax, %rdi, 4), %eax
leave
ret
.type xvalcnt, @function
.size xvalcnt, .-xvalcnt
.cfi_endproc
/* end function xvalcnt */
.section .note.GNU-stack,"",@progbits
qbe $ ./tools/test.sh test/tls.ssa
tls.ssa... --- - Sun Apr 28 15:53:11 2024
+++ /tmp/qbe.zzzz.out Sun Apr 28 15:53:11 2024
@@ -0,0 +1,6 @@
+i0==42
+i1==402653226
+*(x+0)==1
+*(x+4)==2
+*(x+8)==3
+*(x+12)==4
Illegal instruction
[output fail]
Same error as without .cfi_{start,end}proc.
If code size is a concern, maybe emit endbr64 on OpenBSD only?
On Sat, Apr 27, 2024, at 1:42 AM, Quentin Carbonneaux wrote:
> On Fri, Apr 19, 2024, at 15:59, Chenguang Wang wrote:>> This reverts commit 4bc4c9584a13736c20855cdea2203d3bd0a259a3.>>>> We can re-enable BTI now, since the stock `as` in OpenBSD 7.5 seems to>> support it:>>>> qbe $ ./qbe test/tls.ssa > /tmp/tls.s>> qbe $ grep endbr64 /tmp/tls.s | uniq -c>> 6 endbr64>> qbe $ as /tmp/tls.s -o /tmp/tls.o>> qbe $ ls -al /tmp/tls.o>> -rw-r--r-- 1 w wheel 2312 Apr 19 06:57 /tmp/tls.o>>>> isel4.ssa and tls.ssa currently fail with SIGILL on my machine. This>> commit fixes that.>> Hi, do you think we could use .cfi_startproc uniformly across> all targets and let the assembler emit the right instructions?