<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Cannot disable stack protector for particular functions for LTO build with "-Os""
href="https://bugs.llvm.org/show_bug.cgi?id=43789">43789</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Cannot disable stack protector for particular functions for LTO build with "-Os"
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>gsorron@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=22718" name="attach_22718" title="Build example">attachment 22718</a> <a href="attachment.cgi?id=22718&action=edit" title="Build example">[details]</a></span>
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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>