Hello, I worked with github user ziyao233, who is also in this mailing list, 
for a fix in `asm_parse_directive`->`zero_pad` logic, detail can be found at 
https://github.com/ziyao233/tinycc/issues/1

Many thanks to Zi Yao who quickly identified the root cause and guided me for 
issue fix

Problem:

when alignment directive like `.p2align` is used in `.text`, 
`asm_parse_directive` will try to `zero pad` even in executable section, this 
will lead to segmentation fault

Fix:

in `asm_parse_directive` -> `zero_pad:` part, when `sec` is executable, call 
`gen_fill_nops` instead

Open issue:

`gen_fill_nops` is arch specific, I found current non-x86 implementations all 
require pad size to be multiple of 4, while riscv compressed instruction could 
require 2-byte NOPs

Please review attached patch file, thanks!

Regards
Jerry

Attachment: 0001-tccasm.c-fix-asm_parse_directive-zero_pad-logic.patch
Description: 0001-tccasm.c-fix-asm_parse_directive-zero_pad-logic.patch

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to