<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - assembler ELF .section type defaulted wrong for .bss-like sections not named .bss"
href="https://llvm.org/bugs/show_bug.cgi?id=31888">31888</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>assembler ELF .section type defaulted wrong for .bss-like sections not named .bss
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>MC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>roland@hack.frob.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, phosek@chromium.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>In the GNU assembler, several patterns of section name make the default
type be SHT_NOBITS if none was given explicitly in the .section directive.
LLVM's assembler does this for .bss and .tbss, but not the others.
Test case:
.text
.data
d0: .space 1
.section .bss
a: .space 1
.section .bss.foo
b: .space 1
.section .bss.bar,"aw"
b1: .space 1
.section .tbss
c: .space 1
.section .tbss.foo
d: .space 1
.section .tbss.bar,"aw"
d1: .space 1
.section .gnu.linkonce.b
e: .space 1
.section .gnu.linkonce.b.foo
f: .space 1
.section .gnu.linkonce.b.bar,"aw"
f1: .space 1
With GAS, all of these (except .text and .data) get SHT_NOBITS. The cases
with no explicit flags string SHF_ALLOC|SHF_WRITE (as if the flags string
were "aw"), and .tbss* also get SHF_TLS (as if the flags string were
"awT"). .tbss.bar also gets SHT_TLS set even though T did not appear in
the explicit flags string.
With LLVM MC, only .bss and .tbss get SHT_NOBITS and only .tbss gets
SHT_TLS. The cases with no explicit flags string (except for .bss and
.tbss) get no bits set in sh_flags.
I can see the case for not adding SHT_TLS when there was an explicit flags
string. I won't consider it a continuing bug if the .tbss.bar case fails
to add in SHF_TLS.
When the flags or type was omitted, people expect to get the defaults based
on the section name as GAS does.
I'm only looking at the SHT_NOBITS cases here. There are other cases where
GAS defines a default type and default flags based on the name. You can
see them in bfd/elf.c in the special_sections_* tables.</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>