在 2024/2/20 下午7:31, Xi Ruoyao 写道:
On Tue, 2024-02-20 at 19:25 +0800, Xi Ruoyao wrote:
On Tue, 2024-02-20 at 10:07 +0800, chenglulu wrote:
So I think that without worrying about performance and ensuring that
there is no problem
with binutils, I think we can make the following modifications:
-/* "nop" instruction 54525952 (andi $r0,$r0,0) is
- used for padding. */
+/* ".align num,,4" will insert "nop"(andi $r0,$r0,0) into padding by
+ default. */
#define ASM_OUTPUT_ALIGN_WITH_NOP(STREAM, LOG) \
- fprintf (STREAM, "\t.align\t%d,54525952,4\n", (LOG))
+ fprintf (STREAM, "\t.align\t%d,,4\n", (LOG))
What do you think of it?
Unfortunately it will cause warnings with GAS 2.41 or earlier like
t1.s:1: Warning: expected fill pattern missing
t1.s:5: Warning: expected fill pattern missing
And AFAIK these things may cause many test failures due to "excessive
errors" if running the GCC test suite with these earlier GAS versions.
Maybe we'll have to add some autoconf-based probing for the linker
anyway?
Or just silence the warning passing "--no-warn" to the assembler but I'm
highly unsure if this is really a good idea :(.
I am not opposed to adding detection code, but I looked at this problem
today
and I think this change is the smallest change. I asked Meng Qinggang and he
said that the warning of GAS 2.41 can be removed.