This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/11397] New: weak aliases broken on Tru64 UNIX


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11397

           Summary: weak aliases broken on Tru64 UNIX
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ro at techfak dot uni-bielefeld dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alpha-dec-osf5.1
  GCC host triplet: alpha-dec-osf5.1
GCC target triplet: alpha-dec-osf5.1

Consider the following input files:

m.i:

int a (void);

int
main (void)
{
  return a ();
}

wa.i:

int a (void) __attribute__ ((weak, alias ("__a")));

int
__a (void)
{
  return 0;
}

With both 3.3 and current mainline, this fails to link:

> ./xgcc -B./ -v -o m m.i wa.i
Reading specs from ./specs
Configured with: /vol/gnu/src/gcc/gcc-dist/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls alpha-dec-osf5.1
Thread model: single
gcc version 3.4 20030626 (experimental)
 ./cc1 -fpreprocessed m.i -quiet -dumpbase m.i -auxbase m -version -o /tmp//cccnWQFq.s
GNU C version 3.4 20030626 (experimental) (alpha-dec-osf5.1)
        compiled by GNU C version 3.4 20030626 (experimental).
GGC heuristics: --param ggc-min-expand=38 --param ggc-min-heapsize=16384
 as -g -oldas -c -nocpp -O0 -o /tmp//ccdvLGmI.o /tmp//cccnWQFq.s
 ./mips-tfile -v -o /tmp//ccdvLGmI.o /tmp//cccnWQFq.s
mips-tfile (GCC) 3.4 20030626 (experimental)
 ./cc1 -fpreprocessed wa.i -quiet -dumpbase wa.i -auxbase wa -version -o /tmp//cccnWQFq.s
GNU C version 3.4 20030626 (experimental) (alpha-dec-osf5.1)
        compiled by GNU C version 3.4 20030626 (experimental).
GGC heuristics: --param ggc-min-expand=38 --param ggc-min-heapsize=16384
 as -g -oldas -c -nocpp -O0 -o /tmp//ccjaZJjD.o /tmp//cccnWQFq.s
 ./mips-tfile -v -o /tmp//ccjaZJjD.o /tmp//cccnWQFq.s
mips-tfile (GCC) 3.4 20030626 (experimental)
 ./collect2 -G 8 -O1 -S -call_shared -o m /usr/lib/cmplrs/cc/crt0.o -L. -L/usr/lib/cmplrs/cc -L/vol/gcc/lib /tmp//ccdvLGmI.o /tmp//ccjaZJjD.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
a
collect2: ld returned 1 exit status

whereas it links successfully with gcc 3.1:

> gcc -v -o m m.i wa.i
Reading specs from /vol/gnu/lib/gcc-lib/alpha-dec-osf5.1/3.1/specs
Configured with: /vol/gnu/src/gcc/gcc-3.1/configure --prefix=/vol/gnu --with-local-prefix=/vol/gnu --disable-nls alpha-dec-osf5.1
Thread model: single
gcc version 3.1
 /vol/gnu/lib/gcc-lib/alpha-dec-osf5.1/3.1/cc1 -fpreprocessed m.i -quiet -dumpbase m.i -version -o /tmp//ccDh0jFF.s
GNU CPP version 3.1 (cpplib)
GNU C version 3.1 (alpha-dec-osf5.1)
        compiled by GNU C version 3.1.
 as -g -oldas -c -nocpp -O0 -o /tmp//ccLhc2lX.o /tmp//ccDh0jFF.s
 /vol/gnu/lib/gcc-lib/alpha-dec-osf5.1/3.1/mips-tfile -v -o /tmp//ccLhc2lX.o /tmp//ccDh0jFF.s
mips-tfile version 3.1
 /vol/gnu/lib/gcc-lib/alpha-dec-osf5.1/3.1/cc1 -fpreprocessed wa.i -quiet -dumpbase wa.i -version -o /tmp//ccDh0jFF.s
GNU CPP version 3.1 (cpplib)
GNU C version 3.1 (alpha-dec-osf5.1)
        compiled by GNU C version 3.1.
 as -g -oldas -c -nocpp -O0 -o /tmp//ccRGHlct.o /tmp//ccDh0jFF.s
 /vol/gnu/lib/gcc-lib/alpha-dec-osf5.1/3.1/mips-tfile -v -o /tmp//ccRGHlct.o /tmp//ccDh0jFF.s
mips-tfile version 3.1
 /vol/gnu/lib/gcc-lib/alpha-dec-osf5.1/3.1/collect2 -G 8 -O1 -S -call_shared -o m /usr/lib/cmplrs/cc/crt0.o -L/vol/gnu/lib/gcc-lib/alpha-dec-osf5.1/3.1 -L/usr/lib/cmplrs/cc -L/vol/gnu/lib/gcc-lib/alpha-dec-osf5.1/3.1/../../.. /tmp//ccLhc2lX.o /tmp//ccRGHlct.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh

Environment:
System: OSF1 bartok V5.1 732 alpha
Machine: alpha
	
host: alpha-dec-osf5.1
build: alpha-dec-osf5.1
target: alpha-dec-osf5.1
configured with: /vol/gnu/src/gcc/gcc-dist/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls alpha-dec-osf5.1

How-To-Repeat:
Compile/link the test files above.
------- Additional Comments From ro at techfak dot uni-bielefeld dot de  2003-07-01 20:48 -------
Fix:
Examining the assembler output for both compiler versions, I find that gcc
3.4 emits an additional (and superfluous) .weakext pseudo-opcode:

--- wa.s31      Tue Jul  1 22:43:18 2003
+++ wa.s34      Tue Jul  1 22:43:26 2003
@@ -0,0 +1 @@
+       .file   1 "wa.i"
@@ -6 +6,0 @@
-       .file   1 "wa.i"
@@ -22,2 +22 @@
-       bis $31,$31,$1
-       bis $31,$1,$0
+       bis $31,$31,$0
@@ -29,0 +29,2 @@
+       .globl a
+       .weakext        a

It now contains two of those:

        .weakext        a __a
        .weakext        a

Removing the additional one fixes the problem.  The second .weakext is
emitted by varasm.c (weak_finish), while the first (correct) one is from
varasm.c (globalize_decl).  That function should have removed it from
weak_decls, but fails for some reason.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]