https://bugs.llvm.org/show_bug.cgi?id=43789
Bug ID: 43789
Summary: Cannot disable stack protector for particular
functions for LTO build with "-Os"
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedb...@nondot.org
Reporter: gsor...@gmail.com
CC: llvm-bugs@lists.llvm.org, peter.sm...@linaro.org
Created attachment 22718
--> https://bugs.llvm.org/attachment.cgi?id=22718&action=edit
Build example
When building code with LTO and -Os sometimes callee function code gets
inserted into caller. Problem arose when disabling stack protector for such
caller function: linker inserts protector to caller body even if caller
compiled with -fno-stack-protector or attribute.
Please see attached example.
To build example: tar -xvf stack_protector_issue.tar ; cd stack_protector_issue
; make
Check main() in dump.txt after build.
I've got following result:
0000000000201164 <main>:
201164: 50 push %rax
201165: 64 48 8b 04 25 28 00 mov %fs:0x28,%rax
20116c: 00 00
20116e: 48 89 04 24 mov %rax,(%rsp)
201172: 48 8b 7e 08 mov 0x8(%rsi),%rdi
201176: e8 55 00 00 00 callq 2011d0 <atoi@plt>
20117b: 64 48 8b 0c 25 28 00 mov %fs:0x28,%rcx
201182: 00 00
201184: 48 3b 0c 24 cmp (%rsp),%rcx
201188: 75 05 jne 20118f <main+0x2b>
20118a: 0f af c0 imul %eax,%eax
20118d: 59 pop %rcx
20118e: c3 retq
20118f: e8 4c 00 00 00 callq 2011e0 <__stack_chk_fail@plt>
Expected result: main() should not contain stack protector
setting/verification. Maybe callee function shouldn't be inlined in this case.
clang -v:
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-unknown-linux-gnu
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs