🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6065

Help! Strange bug in gnu ld on SunOS 4.1.1 (sun3!)

#6065
From: Franc Grootjen
Date: Fri, 13 Dec 1996 00:00
83 lines
2507 bytes
Hi!

I discovered a strange bug (in gnu ld!?) while trying to compile X11R6.1
on my SUN3/80 running SunOS 4.1.1
Since X11R6.1 is rather big, I took some time to pinpoint the error with
a only a few lines C code.

The problem appears when loading an executable with a shared library
created by gcc/gas/gld.

First create a file called pause.c containing:

void pause()
{
  sleep(3);
}

Compile this C file using:

gcc -c -fpic pause.c

Create a shared library libtest.so.1.0:

ld -o libtest.so.1.0 -assert=pure-text pause.o

Create another C program called go.c:

main()
{
  pause();
}

Try to create an executable:

gcc go.c -L. -ltest

ld will give the error message: 

./libtest.so.1.0: could not read symbols: No symbols

But running 'nm libtest.so.1.0' (gnu version) yields

00000000 A __DYNAMIC
00000020 t ___gnu_compiled_c
00020000 B __bss_start
00020000 D __edata
00020000 B __end
00000034 T __etext
00020000 D _edata
00020000 B _end
00000034 T _etext
00000020 T _pause
         U _sleep
00000020 t gcc2_compiled.
00000020 t pause.o

And 'file libtest.so.1.0':

libtest.so.1.0: mc68020 demand paged shared library executable not stripped

I don't get it. Am I doing something wrong? Don't tell me to use Sun's C
compiler, I'ld like to use gcc. Maybe there is someone who can help me out?!

Franc

P.S.1:
Some version numbers:
gcc version 2.7.2.1
GNU assembler version 2.7 (m68k-sun-sunos4.1.1)
ld version 2.7 (with BFD 2.7)

P.S.2:
gcc 2.7.2.1 generates invalid pic calls: it adds a dummy argument ,a1 to
a jbsr call to inform the Sun assembler to generate PIC. See the corresponding 
code (from m68k.md on more than one place):

    /* The ',a1' is a dummy argument telling the Sun assembler we want PIC,
       GAS just plain ignores it. */
    return \"jbsr %0,a1\";

Well GAS doesn't ignore it. So since I configured gcc to use gas I
patched these lines to generate assembly without the ',a1'
Technical Details
Message-ID: <58rbah$9cg@zeus.cs.kun.nl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,bb6053f0eb1a8308,start
X-Google-Attributes: gid113d02,public
From: sparky@sci.kun.nl (Franc Grootjen)
Subject: Help! Strange bug in gnu ld on SunOS 4.1.1 (sun3!)
Date: 1996/12/13
Message-ID: <58rbah$9cg@zeus.cs.kun.nl>
X-Deja-AN: 203884228
sender: bug-gcc-request@prep.ai.mit.edu
organization: University of Nijmegen, The Netherlands
x-gateway: relay5.UU.NET from bug-gcc to gnu.gcc.bug; Fri, 13 Dec 1996 05:32:18 EST
newsgroups: gnu.gcc.bug