<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64862>64862</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AMDGPU] Clang -cc1as does not recognize the `#exclude` flag
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
backend:AMDGPU
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jhuber6
</td>
</tr>
</table>
<pre>
Some sections in the ELF are emitted with the `SHF_EXCLUDE` section flag. One case where this sometimes shows up is with the `.linker-options` section that is sometimes emitted. If this is passed to `clang -cc1as` it will return an error on an unrecognized flag. Consider the following test input
```asm
.text
.p2alignl 6, 3214868480
.fill 48, 4, 3214868480
.section ".linker-options",#exclude
.section ".note.GNU-stack"
.amdgcn_target "amdgcn-amd-amdhsa--gfx1030"
.amdgpu_metadata
---
amdhsa.kernels: []
amdhsa.target: amdgcn-amd-amdhsa--gfx1030
amdhsa.version:
- 1
- 1
...
.end_amdgpu_metadata
```
If we compile this file with clang, we will see the following error.
```
$ clang test.s --target=amdgcn-amd-amdhsa -mcpu=gfx1030
test.s:4:30: error: unknown flag
.section ".linker-options",#exclude
^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVNuOozgQ_RrzUgIZGxA88JBNOrMjzV6k0Uj71jK4AE-MjWwz6d2vX3HJdNI9s9ool8LlOlV16qSE96o3iDXJfyH5KRJzGKyrvw5zg66IGiv_rj_bEcFjG5Q1HpSBMCA8fTqDcAg4qhBQwlWFYXWQgn7-9fz89Nfx05fTEynoLRQ6LfoE_jAIrfAI1wEdQhiUB29HDGpED36wVw_zBMo_QCZamQu62E5rFfewYRABHkD2mhL42G34ysMkvEcJwS5orRamh7htU7FCqQBXpTU4DLMzIAygc9aBXe3ZOGxtb9Q_KPcmjtZ4JdGt5XVWa3tVpoeAPoAy0xwIPRF62L8Lur2FH2_nVRLwJbw-TUxo1RsNBWFH4CzNyqLMSvp6o1sKzMrFnf3szk4JoRVh7C1ljBF2JIzjS6tniT-LMjZg8uH3L7EPor0sUd8vilH2rXkOwvUYgDC2HcRilMtn8CKO--4lpZy-i5vm5xGDkCKIzRHH8WZskckFnUHtCT_ApsUH75ZzcQL8R9b7kG_o_NIW38cAEEP6zkyS5GFWtErQyOcflvxmnPeHHzu4IrR2nJTeRd0t1qrhVW7LzK646cwjvlHOqrfkhwmAsGyDWPWVeIjjGx2nd1xAPLbTTPjpgZI9kvBDRviB04XINeVizOZi7HX7f9742V43adye_6-qgORPb3qJZM1lxSsRYZ0WFStYXqYsGuoGU9l0Be3KCkVO85Y3VFacck5L0XZdpGpGGaclS1Oe05QlNJedkFXTZsgy1iDJKI5C6UTrb2NiXR8p72esi6wsWKRFg9qv-42xfRJbzawR7QWNJPxw-O304c8viyM_Ra5egOJm7j3JqFY--FfooIJet-Uekp_geLdNQFr0YGyA7zvjtsLuSCroSnY0O10PIUzLYAg7E3buVRjmJmntSNh5Sbr_xJOzX7ENhJ3X5jxh57W_fwMAAP__3arBew">