Article View: gnu.gcc.help
Article #51641FAQ addition: How to use GCC-2.3.3 for Solaris device drivers
From: Gordon W. Ross
Date: Wed, 28 Apr 1993 19:00
Date: Wed, 28 Apr 1993 19:00
53 lines
2279 bytes
2279 bytes
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Content-Lines: 12
For your info, I've attached notes on compiling kernel code with GCC.
The -fno_builtin option avoids conflicts between declarations of
builtin functions and those in the system header files. The -s flag
on ld keeps the kernel from doing a panic while relocating the symbols
contained in the loadable driver object. Evidently the kernel does
not understand some of the debugging info which is stripped when
ld is given the -s flag. I am using 'as' and 'ld' from Sun.
Feel free to post this or include it with GCC as you wish.
Gordon W. Ross Mercury Computer Systems
gwr@mc.com 199 Riverneck Road
508-256-0052x295 Chelmsford, MA 01824-2820
----------
X-Sun-Data-Type: default
X-Sun-Data-Name: Makefile
X-Sun-Content-Lines: 16
# Makefile for Solaris sample driver
# For kernel linking, we need to augment libgcc.a
LIBGCC=/opt/gnu/lib/gcc-lib/sparc-sun-solaris2/2.3.3/libgcc.a
KDEFS= -D_KERNEL -DSUNDDI -DSVR4
CFLAGS= $(MORECPP) -O
CC=gcc -fno-builtin -D__STDC__=0
mymem : mymem.c libgcck.a
$(CC) $(KDEFS) $(CFLAGS) -c $@.c
ld -r -s -o $@ $@.o libgcck.a
libgcck.a : $(LIBGCC) memcpy.o
-rm -f $@
cp $(LIBGCC) $@
ar r $@ memcpy.o
----------
X-Sun-Data-Type: c-file
X-Sun-Data-Name: memcpy.c
X-Sun-Content-Lines: 10
/*
* GCC generates calls to memcpy internally,
* but there is no memcpy() in the kernel.
* Give this to "ld -r ..." when linking.
*/
void
*memcpy(void *dst, const void *src, unsigned int n)
{
bcopy(src, dst, n);
}
Technical Details
Message-ID:
<9304281319.AA09187@walnut>Path:
arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uknet!bnr.co.uk!bnrgate!nott!torn!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jericho.mc.com!gwrShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,4adc650d5a847bfb,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-04-28 12:58:00 PST Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uknet!bnr.co.uk!bnrgate!nott!torn!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jericho.mc.com!gwr From: gwr@jericho.mc.com (Gordon W. Ross) Newsgroups: gnu.gcc.help Subject: FAQ addition: How to use GCC-2.3.3 for Solaris device drivers Date: 28 Apr 1993 15:00:09 -0400 Organization: GNUs Not Usenet Lines: 54 Sender: daemon@cis.ohio-state.edu Distribution: gnu Message-ID: <9304281319.AA09187@walnut> Reply-To: gwr@jericho.mc.com