home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / atari / st / 18630 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.8 KB  |  52 lines

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