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