This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: optimization/8156 (bad assembler code)
- From: Andreas Jaeger <aj at suse dot de>
- To: bregor at sf dot anu dot edu dot au
- Cc: libc-alpha at sources dot redhat dot com, gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 Oct 2002 21:02:37 +0200
- Subject: Re: optimization/8156 (bad assembler code)
- References: <200210071719.59555.bregor@sf.anu.edu.au>
I'm redirecting this to libc-alpha, since this bug which was reported
as GCC bug, looks like a glibc problem.
"Roger W. Brown" <bregor@sf.anu.edu.au> writes:
> Bad assembler code produced by -mcpu=i686 -march=i686
> switches when compiling glibc-2.3 with gcc (GCC) 3.2.1 20021004
> (prerelease)
>
> The fault appears in the gcc-2.3/signal directory and
> may be reproduced by compiling the code below.
> (now called Fred.c)
>
> #include <sysdep.h>
> PSEUDO (__kill, kill, 2)
> ret
> PSEUDO_END(__kill)
> libc_hidden_def (__kill)
> weak_alias (__kill, kill)
> libc_hidden_weak (kill)
>
> /usr/bin/gcc -pipe -mcpu=i686 -march=i686 -S -I../include \
> -I. -I/Main/Glibc/glibc-2.3/Build/signal -I.. -I../libio \
> -I/Main/Glibc/glibc-2.3/Build -I../sysdeps/i386/elf \
> -I../linuxthreads/sysdeps/unix/sysv/linux/i386 \
> -I../linuxthreads/sysdeps/unix/sysv/linux \
> -I../linuxthreads/sysdeps/pthread -I../sysdeps/pthread \
> -I../linuxthreads/sysdeps/unix/sysv \
> -I../linuxthreads/sysdeps/unix \
> -I../linuxthreads/sysdeps/i386/i686 \
> -I../linuxthreads/sysdeps/i386 \
> -I../sysdeps/unix/sysv/linux/i386 \
> -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu \
> -I../sysdeps/unix/common -I../sysdeps/unix/mman \
> -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 \
> -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 \
> -I../sysdeps/unix -I../sysdeps/posix \
> -I../sysdeps/i386/i686/fpu -I../sysdeps/i386/i686 \
> -I../sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../sysdeps/i386 \
> -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 \
> -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 \
> -I../sysdeps/ieee754 -I../sysdeps/generic/elf \
> -I../sysdeps/generic -I /lib/modules/2.4.19-pre10/build/include \
> -D_LIBC_REENTRANT -include ../include/libc-symbols.h \
> -DPIC -DSHARED -DASSEMBLER -DGAS_SYNTAX \
> -x assembler-with-cpp Fred.c > Fred-i686.a
>
> The same command string but without the -mcpu and -march switches
> created file Fred-default.a
>
>
> as Fred-default.a (okay)
> as Fred-i686.a
> Fred-i686.a: Assembler messages:
> Fred-i686.a:49: Warning: rest of line ignored; first ignored character is `1'
> Fred-i686.a:49: Warning: rest of line ignored; first ignored character is `1'
> Fred-i686.a:49: Warning: rest of line ignored; first ignored character is `1'
> Fred-i686.a:49: Error: unrecognized symbol type ""
> Fred-i686.a:49: Warning: rest of line ignored; first ignored character is `1'
> Fred-i686.a:49: Warning: rest of line ignored; first ignored character is `1'
> Fred-i686.a:49: Error: junk `.get_pc_thunk.bx' after expression
The difference is:
0:pushl %ebx; .section .gnu.linkonce.t. 1 .get_pc_thunk.bx,"ax",@progbits;
versus:
0:pushl %ebx; .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits;
The string __i686 has been replaced by a 1 since __i686 is defined.
The problem here is sysdeps/unix/sysv/linux/i386/sysdep.h which defines:
# define SETUP_PIC_REG(reg) \
.section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits; \
.globl __i686.get_pc_thunk.reg; \
.hidden __i686.get_pc_thunk.reg; \
.type __i686.get_pc_thunk.reg,@function; \
__i686.get_pc_thunk.reg: \
movl (%esp), %e##reg; \
ret; \
.previous; \
call __i686.get_pc_thunk.reg
# endif
-march=i686 defines "__i686" which is replaced by a "1" in the above.
I propose to change sysdep.h as a workaround. Is there also a bug in
GCC?
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj