Re: vax binutils 2.39 gas problems

Johnny Billquist <[email protected]>
Newsgroups gmane.os.netbsd.ports.vax,gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
Hmm. Unless I'm getting this wrong, the error comes from the assembly 
phase. So could you compare the .s files with and without those extra 
spaces for the last line of the _asm() ?

But yeah, sounds like gas wants some whitespace after the last character 
to be happy. Newline or spaces, or at least something. (I'm sort of 
wondering if it somehow sucks in the next line, containing "# 0 "" 2" 
and that's where the complaints about the missing closing quote comes from.)

Also, do you get the same result if you just run gas on the .s files 
directly?

   Johnny

On 2023-01-27 16:02, Izumi Tsutsui wrote:
> It looks vax builds fail in many sources that use __asm() statements
> after switching vax to using new binutils 2.39.
> 
> Daily buildlog says:
>   https://releng.netbsd.org/builds/HEAD/202301261240Z/vax.build.failed
>> dependall ===> lib/../external/gpl3/gcc/lib/libgcc/libgcov
>> /home/source/ab/HEAD/src/external/gpl3/gcc/dist/libgcc/libgcc2.c: Assembler messages:
>> /home/source/ab/HEAD/src/external/gpl3/gcc/dist/libgcc/libgcc2.c:553: Error: unknown pseudo-op: `.'
> 
> 
> In src/sys/arch/vax/boot/boot (to commit my local fix) I got:
> ---
> #   compile  sa/loadfile.o
> /s/cvs/src/obj.vax/tooldir.NetBSD-9.3-i386/bin/vax--netbsdelf-gcc -O2 \
> -ffreestanding -fno-pic -fno-unwind-tables    -std=gnu99  -Wall \
> -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
> -Wno-sign-compare  -Wsystem-headers   -Wno-traditional \
>    -Wa,--fatal-warnings  -Werror  \
>    -I/s/cvs/src/sys/arch/vax/boot/boot/../../../../lib/libsa \
> --sysroot=/s/cvs/src/obj.vax/destdir.vax -DSUPPORT_BOOTPARAMS \
> -DSUPPORT_BOOTP -DSUPPORT_DHCP -D_STANDALONE -DNO_MID_CHECK \
> -DLIBSA_CREAD_NOCRC -I/s/cvs/src/sys/arch/vax/boot/boot/../../../../lib/libkern/../../../common/lib/libc/quad \
> -I/s/cvs/src/sys/arch/vax/boot/boot/../../../../lib/libkern/../../../common/lib/libc/string \
> -I/s/cvs/src/sys/arch/vax/boot/boot/../../../../lib/libkern/../../../common/lib/libc/arch/vax/string \
> -I/s/cvs/src/sys/arch/vax/boot/boot/../../../../lib/libkern/../../../common/lib/libc/arch/vax/atomic \
> -I/s/cvs/src/sys/arch/vax/boot/boot/../../../../lib/libkern/../../../common/lib/libc/hash/sha3 \
> -I../../. -I/s/cvs/src/sys/arch/vax/boot/boot/../../../../ \
> -I/s/cvs/src/sys/arch/vax/boot/boot/../../ \
> -I/s/cvs/src/sys/arch/vax/boot/boot/../common -I/s/cvs/src/sys/arch/vax/boot/boot/../../include \
> -DRELOC=0x7d0000 -D_STANDALONE \
> -I/s/cvs/src/sys/arch/vax/boot/boot/../../../../lib/libsa/../../../common/dist/zlib \
>   -DCOMPAT_UFS  -D__INTERNAL_LIBSA_CREAD  -Wno-pointer-sign -c  \
>    /s/cvs/src/sys/arch/vax/boot/boot/../../../../lib/libsa/loadfile.c \
> -o loadfile.o
> loadfile.s: Assembler messages:
> loadfile.s:99: Warning: missing closing `"'
> loadfile.s:99: Fatal error: Ignoring statement due to "Unknown operator"
> 
> *** Failed target:  loadfile.o
> ---
> 
> The asm file around line 99 in loadfile.S per -save_temps:
> ---
>   87  .L8:
>   88  	pushab .LC2
>   89  	calls $1,(%r6)
>   90  	movzbl $79,errno
>   91  	movzbl $79,%r0
>   92  	ret
>   93  .L34:
>   94  #APP
>   95  # 47 "../.././machine/byte_swap.h" 1
>   96  	rotl	$-8, %r0, %r2	
>   97  insv	%r2, $16, $8, %r2	
>   98  rotl	$8, %r0, %r1	
>   99  movb	%r1, %r2
> 100  # 0 "" 2
> 101  #NO_APP
> 102  	cmpw %r2,$263
> 103  	jeql .L12
> 104  #APP
> 105  # 47 "../.././machine/byte_swap.h" 1
> 106  	rotl	$-8, %r0, %r2	
> 107  insv	%r2, $16, $8, %r2	
> 108  rotl	$8, %r0, %r1	
> 109  movb	%r1, %r2
> 110  # 0 "" 2
> 111  #NO_APP
> ---
> 
> So it's come from inline asm in byte_swap.h:
> 
> ---
> static __inline uint32_t __attribute__((__unused__))
> __byte_swap_u32_variable(uint32_t x)
> {
> 	uint32_t y;
> 
> 	__asm volatile(
> 		"rotl $-8, %1, %0 \n"
> 		"insv %0, $16, $8, %0 \n"
> 		"rotl $8, %1, %%r1 \n"
> 		"movb %%r1, %0"
> 		: "=&r" (y)
> 		: "r" (x)
> 		: "r1", "cc");
> 
> 	return (y);
> }
> ---
> 
> If I changed the following line in the inline function
>> 		"movb %%r1, %0"
> to
>> 		"movb %%r1, %0  "
> gas no longer complained it, so it smells corrupted buffer.
> 
> I have checked several changes in binutils/dist/gas/config/tc-vax.c
> but I cannot find an obvious one.
> 
> Any ideas?
> 
> ---
> Izumi Tsutsui

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: [email protected]             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.