home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.atari.st
- Path: sparky!uunet!elroy.jpl.nasa.gov!hanauma.jpl.nasa.gov!hyc
- From: hyc@hanauma.jpl.nasa.gov (Howard Chu)
- Subject: Re: gcc baserel tcsh etc (was Re: Virtual Memory on MultiTos)
- Message-ID: <1992Dec19.010320.26743@elroy.jpl.nasa.gov>
- Sender: news@elroy.jpl.nasa.gov (Usenet)
- Nntp-Posting-Host: hanauma.jpl.nasa.gov
- Organization: SAR Systems Development & Processing, JPL
- References: <1992Dec16.201905.2006@netcom.com> <1992Dec16.043917.1193@cc.umontreal.ca> <1gt7r0INNhrd@usenet.INS.CWRU.Edu>
- Date: Sat, 19 Dec 1992 01:03:20 GMT
- Lines: 39
-
- In article <1gt7r0INNhrd@usenet.INS.CWRU.Edu> an375@cleveland.Freenet.Edu (Jason Baker) writes:
- >>(gcc can compile shared text programs if it is given the -mbaserel
- >>parameter)
-
- > I was wondering what that meant. The new mintlib readme metions
- >-mpcrel (or something). What does this mean; under what conditions will
- >gcc generate non-pc-relative code? Does the new gcc support both shared
- >and private data in the same program?
-
- The -mbaserel and -mpcrel options are independent, they just both happened
- to be added at the same time. The pc-relative stuff is very primitive, and
- of only marginal use. Ordinarily GCC generates long-absolute addresses for
- everything (except stack slots and register variables, of course). The
- PC-relative option causes GCC to try pc-relative addressing for any items
- that reside in the text segment. There's no error-checking in the compiler
- though, so it's possible to wind up with a pc-relative reference that
- doesn't fit in the available 16 bit offset. (Oh, correction, GCC always uses
- pc-relative code for generating the jump table for switch statements...)
-
- The base-relative option causes all static and global variable references to
- be made using a 16 bit offset from a base register (currently it's configured
- to use register a4). Using this setup, there are no absolute references to
- data or bss from the code, which allows a single copy of the code to be used
- by multiple independent processes. In this approach, all data is private.
- However, any items declared as "const" will go in the text segment, and so can
- be considered to be shared initialized data (except that it's read-only data).
- The compiler support for base-relative also doesn't do any error checking, so
- it's also possible to generate code that won't successfully link. (The linker
- performs all of the checks to see if all the addresses fit in their given
- 16 bit offsets.)
-
- I'm working on an enhancement to make the linker perform the pc-relative code
- transformations, since it will have enough information to do a better job at
- it, as well as an improved version of the base-relative code generation that
- will be less affected by size constraints...
- --
- -- Howard Chu @ Jet Propulsion Laboratory, Pasadena, CA
-
- All true wisdom is conveyed in one-line witticisms.
-