home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / wizards / 5283 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.6 KB  |  45 lines

  1. Path: sparky!uunet!ogicse!mimbres.cs.unm.edu!constellation!servalan!rmtodd
  2. From: rmtodd@servalan.servalan.com (Richard Todd)
  3. Newsgroups: comp.unix.wizards
  4. Subject: Re: What is text, data & bss anyway?
  5. Message-ID: <BzHJEr.3Kn@servalan.servalan.com>
  6. Date: 19 Dec 92 02:39:47 GMT
  7. Article-I.D.: servalan.BzHJEr.3Kn
  8. References: <1992Dec15.085938.5975@ericsson.se> <15907@auspex-gw.auspex.com> <MOSS.92Dec16110746@CRAFTY.cs.cmu.edu> <15988@auspex-gw.auspex.com>
  9. Organization: Ministry of Silly Walks
  10. Lines: 33
  11.  
  12. guy@Auspex.COM (Guy Harris) writes:
  13.  
  14. >What does GCC do with
  15.  
  16. >    const int foo[] = { 1, 137, 666 };
  17.  
  18. >Does it put it in the text or data segments?  (Text segment, I hope.) 
  19. >The answer should be the same as the answer to my original question....
  20.  
  21. As you can see from this example, it puts it in the text segment.  Glad to
  22. see that GCC did the right thing.  (This is with gcc 2.1;  I presume they
  23. haven't changed this in more recent gcc versions...)
  24. ---------------------------------------------------------------------------
  25. 295 servalan /tmp[8:34pm] Z% cat foo.c
  26.  const int foo[] = { 1, 137, 666 };
  27. 296 servalan /tmp[8:35pm] Z% gcc -fwritable-strings -S foo.c 
  28. 297 servalan /tmp[8:35pm] Z% cat foo.s
  29. #NO_APP
  30. gcc2_compiled.:
  31.         .file "foo.c"
  32. .globl foo
  33. .text
  34.         .even
  35. foo:
  36.         .long 1
  37.         .long 137
  38.         .long 666
  39. 298 servalan /tmp[8:35pm] Z% 
  40. ---------------------------------------------------------------------------
  41. --
  42. Richard Todd    rmtodd@uokmax.ecn.uoknor.edu  rmtodd@chinet.chi.il.us
  43.   rmtodd@servalan.uucp  New Improved Domain: rmtodd@servalan.servalan.com
  44. "Try looking in the Yellow Pages under 'Psychotics'." -- Michael Santana
  45.