public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* .text, .data and .bbs!!
@ 2010-12-04 11:16 ali hagigat
  2010-12-04 21:07 ` Nicolás Dato
  0 siblings, 1 reply; 5+ messages in thread
From: ali hagigat @ 2010-12-04 11:16 UTC (permalink / raw)
  To: gcc-help

I want to write a C or Assembly program and compile it by GCC. Is it
possible to compile(or assemble) the code so that the final object
code does not have any .text, .data and .bss sections?
Generating these sections are compulsory by GCC?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .text, .data and .bbs!!
  2010-12-04 11:16 .text, .data and .bbs!! ali hagigat
@ 2010-12-04 21:07 ` Nicolás Dato
  2010-12-05  7:20   ` ali hagigat
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolás Dato @ 2010-12-04 21:07 UTC (permalink / raw)
  To: gcc-help

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ali hagigat wrote:
> I want to write a C or Assembly program and compile it by GCC. Is it
> possible to compile(or assemble) the code so that the final object
> code does not have any .text, .data and .bss sections?
> Generating these sections are compulsory by GCC?

I think those sections are compulsory by the kernel! but i don't know, you are perhaps
looking for something "flat", without sections, without header, just the assembled code,
right? like a .com windows program? (in this case i don't have the answer)
Because an ELF (also PE) program must have sections, usually one for the code (you can
execute and read, but not write), other for the variables (read and write access, -also
execute-), and another section with the addresses of the imported functions.
*I think* this is how it works nowadays.

- --
"Do you pine for the nice days of minix-1.1, when men were men and wrote their own device
drivers?" -- Linus Torvalds
"If you want to go somewhere, goto is the best way to get there." --  Ken Thompson
"Value your freedom or you will lose it" -- Richard Stallman

GNU/Linux Registered User #460377
Slackware 13.0 64 bits

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkz6n/sACgkQOLozpb7LE6JgrgCfcs1RNxHaTfG/Tee1u4yuV4v2
lrgAoJk4YVEQIQHMeYZ5lg5EsVWo4GFx
=4mmg
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .text, .data and .bbs!!
  2010-12-04 21:07 ` Nicolás Dato
@ 2010-12-05  7:20   ` ali hagigat
  0 siblings, 0 replies; 5+ messages in thread
From: ali hagigat @ 2010-12-05  7:20 UTC (permalink / raw)
  To: Nicolás Dato; +Cc: gcc-help

Thank you for the reply. We see .text, .data and .bss for any
C/Assembly code compiled by GNU GCC. I am using Linux, Fedora 12 and
my question was not about Windows.
I want to jump into the technical details of open source tools like
GCC. I know that I can define some new sections but , will .text exist
anyway?
Nicolas, having those sections are not related to Kernel!!, Kernel has
a loader and it will load ELF by the information of its header. What
is the role of .text in this header, is it a predefined default name?
or it can be any name we specify inside the program?
These are some questions we can deal with.

On 12/4/10, Nicolás Dato <nicolas.dato@gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> ali hagigat wrote:
>> I want to write a C or Assembly program and compile it by GCC. Is it
>> possible to compile(or assemble) the code so that the final object
>> code does not have any .text, .data and .bss sections?
>> Generating these sections are compulsory by GCC?
>
> I think those sections are compulsory by the kernel! but i don't know, you
> are perhaps
> looking for something "flat", without sections, without header, just the
> assembled code,
> right? like a .com windows program? (in this case i don't have the answer)
> Because an ELF (also PE) program must have sections, usually one for the
> code (you can
> execute and read, but not write), other for the variables (read and write
> access, -also
> execute-), and another section with the addresses of the imported functions.
> *I think* this is how it works nowadays.
>
> - --
> "Do you pine for the nice days of minix-1.1, when men were men and wrote
> their own device
> drivers?" -- Linus Torvalds
> "If you want to go somewhere, goto is the best way to get there." --  Ken
> Thompson
> "Value your freedom or you will lose it" -- Richard Stallman
>
> GNU/Linux Registered User #460377
> Slackware 13.0 64 bits
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkz6n/sACgkQOLozpb7LE6JgrgCfcs1RNxHaTfG/Tee1u4yuV4v2
> lrgAoJk4YVEQIQHMeYZ5lg5EsVWo4GFx
> =4mmg
> -----END PGP SIGNATURE-----
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .text, .data and .bbs!!
  2010-12-05  7:19 ali hagigat
@ 2010-12-06  0:06 ` Nicolás Dato
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolás Dato @ 2010-12-06  0:06 UTC (permalink / raw)
  To: gcc-help

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ali hagigat wrote:
> my question was not about Windows.

I was asking if you wanted to generate something like the .com windows program but with
gcc. the .com are those 16bits programs without header without sections without anything
extra, just the assembled instructions.
Anyway i can't help you with gcc and ELF technical details :S


Saludos.

- --
"Do you pine for the nice days of minix-1.1, when men were men and wrote their own device
drivers?" -- Linus Torvalds
"If you want to go somewhere, goto is the best way to get there." --  Ken Thompson
"Value your freedom or you will lose it" -- Richard Stallman

GNU/Linux Registered User #460377
Slackware 13.0 64 bits

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkz8G4UACgkQOLozpb7LE6JgqgCeNqtdp7hgR+88B9IpK3jys/oA
n+YAn1RNLIRv5ZUahSVS97cxB5tytwBh
=1zlG
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* .text, .data and .bbs!!
@ 2010-12-05  7:19 ali hagigat
  2010-12-06  0:06 ` Nicolás Dato
  0 siblings, 1 reply; 5+ messages in thread
From: ali hagigat @ 2010-12-05  7:19 UTC (permalink / raw)
  To: gcc-help

Thank you for the reply. We see .text, .data and .bss for any
C/Assembly code compiled by GNU GCC. I am using Linux, Fedora 12 and
my question was not about Windows.
I want to jump into the technical details of open source tools like
GCC. I know that I can define some new sections but , will .text exist
anyway?
Nicolas, having those sections are not related to Kernel!!, Kernel has
a loader and it will load ELF by the information of its header. What
is the role of .text in this header, is it a predefined default name?
or it can be any name we specify inside the program?
These are some questions we can deal with.
- Hide quoted text -

On 12/4/10, Nicolás Dato <nicolas.dato@gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> ali hagigat wrote:
>> I want to write a C or Assembly program and compile it by GCC. Is it
>> possible to compile(or assemble) the code so that the final object
>> code does not have any .text, .data and .bss sections?
>> Generating these sections are compulsory by GCC?
>
> I think those sections are compulsory by the kernel! but i don't know, you
> are perhaps
> looking for something "flat", without sections, without header, just the
> assembled code,
> right? like a .com windows program? (in this case i don't have the answer)
> Because an ELF (also PE) program must have sections, usually one for the
> code (you can
> execute and read, but not write), other for the variables (read and write
> access, -also
> execute-), and another section with the addresses of the imported functions.
> *I think* this is how it works nowadays.
>
> - --
> "Do you pine for the nice days of minix-1.1, when men were men and wrote
> their own device
> drivers?" -- Linus Torvalds
> "If you want to go somewhere, goto is the best way to get there." --  Ken
> Thompson
> "Value your freedom or you will lose it" -- Richard Stallman
>
> GNU/Linux Registered User #460377
> Slackware 13.0 64 bits
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkz6n/sACgkQOLozpb7LE6JgrgCfcs1RNxHaTfG/Tee1u4yuV4v2
> lrgAoJk4YVEQIQHMeYZ5lg5EsVWo4GFx
> =4mmg
> -----END PGP SIGNATURE-----
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-06  0:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-04 11:16 .text, .data and .bbs!! ali hagigat
2010-12-04 21:07 ` Nicolás Dato
2010-12-05  7:20   ` ali hagigat
2010-12-05  7:19 ali hagigat
2010-12-06  0:06 ` Nicolás Dato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).