<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120871>120871</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
pushsection idiom for GDB scripts not supported by integrated `as` and llvm-mc for arm targets
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lf-
</td>
</tr>
</table>
<pre>
```
$ armv7l-unknown-linux-gnueabihf-cc test.c
<inline asm>:1:41: error: expected '%<type>' or "<type>"
1 | .pushsection ".debug_gdb_scripts", "MS",@progbits,1
| ^
<inline asm>:4:12: error: .popsection without corresponding .pushsection
4 | .popsection
| ^
2 errors generated.
$ armv7l-unknown-linux-gnueabihf-cc -no-integrated-as test.c
<completes successfully>
```
There is an assembly idiom as follows which works with both `-no-integrated-as` and `-integrated-as` on the Clang x86 target, but not on the armv7 target. This causes some build breakage of code using this idiom which is accepted by GNU `as` and Clang with `-no-integrated-as`.
Code:
```c
asm (
".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n"
".byte 1 /* Python */\n"
".asciz \"whatkillsusmakesusdeader.py\"\n"
".popsection");
int main(void) {
}
```
Repro using llvm-mc:
```asm
.pushsection ".debug_gdb_scripts", "MS",@progbits,1
.byte 1 /* Python */
.asciz "whatkillsusmakesusdeader.py"
.popsection
```
```
$ llvm-mc --arch=x86 /tmp/test.s
.text
.section .debug_gdb_scripts,"MS",@progbits,1
.byte 1
.ascii "whatkillsusmakesusdeader.py"
.byte 0
.text
$ llvm-mc --arch=arm /tmp/test.s
.text
/tmp/test.s:1:41: error: expected '%<type>' or "<type>"
.pushsection ".debug_gdb_scripts", "MS",@progbits,1
^
.byte 1
.ascii "whatkillsusmakesusdeader.py"
.byte 0
/tmp/test.s:4:12: error: .popsection without corresponding .pushsection
.popsection
^
```
Compare:
```
$ » armv7l-unknown-linux-gnueabihf-as test.s
$ » armv7l-unknown-linux-gnueabihf-as --version
GNU assembler (GNU Binutils) 2.43.1
Copyright (C) 2024 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `armv7l-unknown-linux-gnueabihf'.
```
```
$ armv7l-unknown-linux-gnueabihf-cc --version
clang version 18.1.8
Target: armv7l-unknown-linux-gnueabihf
Thread model: posix
InstalledDir: /nix/store/02xcipa0v0dc1qv9kdihdkffq7crsjr6-clang-18.1.8/bin
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0V01v27oS_TX0ZiBBomzZXnjhOHVR4PWheO1bFxQ5kthQpMqPOL6__oK0nMRJ2voCuUHgSJwhPWd4Zs6EOSc7jbghixuyuJ2x4HtjN6rNZo0Rxw2pi-m32BI6B2aH-6XKgr7T5qAzJXV4yDodkDWybzPOwaPzOY_u1U5qJTUCcwOpPpBqW5JqO48fgNYamx4eRuQeBRC6JHRBqp0_jhjd6RKMBULp8zVKii0AQAlkuYN8DK53yL00OnrmApvQfe9E891xK0fv4g66i7bPX0_PZF6M1nSNjMZdOZ0H6bxrf8jiw9sA5xEkvQCYj2Y8h3iQvjfBAzfWohuNFlJ3FyimcOYTvMetvwrzFAk9fZ2DDjVa5lHkV99Xpk0mtccu7cuYu7hBboZRoUcHLnCOzrVBqWMEW2wvuFFsv_VoEaQDpoE5h0OjjiCFNAMwB61RyhwcHHrJezgYe-dSOqAxvgdSF6_iIHUBTItke2UwGnyPsFNMd_CwqsEz26GPd90ED9r4s0vKwGTO4VsvHXAWXERkBoQmSCWgscjuWIdgWuBGIAQXb8ZH7xOEU9wRHec4RsI2R_j43__H8J5iPcWTcP0CUn5K1s4IJNX2eRZjxpkbgNBVujx6ye7F7m2Cp_XE8fT0-evjykumL3b6VEDxoOboMVYR3RO6hS9H36cS2saFC0fmuPxrOvzQM38nlXLBDewOXXACmUCbj8fpWy-2PqNvDGhNqpsTeqk9DExqQlf3RgpC10CWyba8f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