From: anhaeupl@late.e-technik.uni-erlangen.DE (Bernd Anhaeupl)
Newsgroups: gnu.gcc.bug
Subject: gcc 2.3.1 - HPPA shared libraries bug
Date: 9 Nov 92 12:24:10 GMT
Distribution: gnu
Organization: GNUs Not Usenet

gcc Version: 2.3.1 (both versions from prep.ai.mit edu and jaguar.cs.utah.edu (u1))
gcc config: configure hp720-hpux --gas

description:
the following program does not link using the shared libraries:
------------cut here-----------------
#include <stdio.h>

static int (*a)(char const *,...) = printf;

int main()
{
    (*a)("Hello, world!\n");
    return 0;
}
------------cut here-----------------
compilation without static:
------------------------------------------
gcc -V 2.3.1 -v test.c
Reading specs from /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/specs
gcc version 2.3.1-u1
 /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/cpp -lang-c -v -undef -D__GNUC__=2 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D_HPUX_SOURCE -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__-D__PWB__ -D__hpux__ -D__unix__ -D___HPUX_SOURCE__ -D__hppa -D__hp9000s800 -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -D___HPUX_SOURCE test.c /usr/tmp/cca01849.i
GNU CPP version 2.3.1 (hppa)
 /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/cc1 /usr/tmp/cca01849.i -quiet -dumpbase test.c -version -o /usr/tmp/cca01849.s
GNU C version 2.3.1 (hppa) compiled by GNU C version 2.3.1.
 /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/as -o /usr/tmp/cca018491.o /usr/tmp/cca01849.s
 /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/ld -u main -L/users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1 -L/users/late/gnu/lib /lib/crt0.o /usr/tmp/cca018491.o /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/libgcc.a -lc /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/libgcc.a
ld: R_DATA_ONE_SYMBOL fixup in file /usr/tmp/cca018491.o for code unsat symbol "printf" - use P' fixup
collect: /bin/ld returned 1 exit status
-------------------------------------------
compilation with -static (after simple patch to specs which inserts -a archive when linking)
-------------------------------------------
gcc -V 2.3.1 -static -v test.c
Reading specs from /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/specs
gcc version 2.3.1-u1
 /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/cpp -lang-c -v -undef -D__GNUC__=2 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D_HPUX_SOURCE -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__-D__PWB__ -D__hpux__ -D__unix__ -D___HPUX_SOURCE__ -D__hppa -D__hp9000s800 -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -D___HPUX_SOURCE test.c /usr/tmp/cca01898.i
GNU CPP version 2.3.1 (hppa)
 /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/cc1 /usr/tmp/cca01898.i -quiet -dumpbase test.c -version -o /usr/tmp/cca01898.s
GNU C version 2.3.1 (hppa) compiled by GNU C version 2.3.1.
 /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/as -o /usr/tmp/cca018981.o /usr/tmp/cca01898.s
 /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/ld -u main -a archive -L/users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1 -L/users/late/gnu/lib /lib/crt0.o /usr/tmp/cca018981.o /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/libgcc.a -lc /users/late/gnu/lib/gcc-lib/hp720-hpux/2.3.1/libgcc.a
-----------------------------------------------------------------------------------
ps:
HPUX 8.07 cc also does not like this program, if you use an intermediate assembler file:
---------------------------
cc -S test.c; cc test.s
as: test.s @line#2 [err#7]
  (warning) Space characteristics may not be changed after first declaration
as: test.s @line#36 [err#7]
  (warning) Space characteristics may not be changed after first declaration
/bin/ld: R_DATA_ONE_SYMBOL fixup in file test.o for code unsat symbol "printf" - use P' fixup
---------------------------

Bernd Anhaeupl
(anhaeupl@late.e-technik.uni-erlangen.de)
 
Newsgroups: gnu.gcc.bug