linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Plantz <plantz@sonoma.edu>
To: Sofiane Akermoun <akersof@gmail.com>, ishare <june.tune.sea@gmail.com>
Cc: "linux-assembly@vger.kernel.org" <linux-assembly@vger.kernel.org>
Subject: RE: how to use .section command in asm code?
Date: Mon, 4 Mar 2013 15:31:35 +0000	[thread overview]
Message-ID: <6E3CF6FDA48EC747AAAE0EAEDF16EFF802C7E62F@coronet.solar.sonoma.edu> (raw)
In-Reply-To: <CAN0_x-JmEGNH+efO0z86GFx1CepZwFqJXp-05bgcCXL9AO7LEg@mail.gmail.com>

Actually, the terminology is "assembler directive", "assembly directive", "pseudo opcode", "pseudo-operation", or "pseudo-op". They direct the assembler to do things as it assembles the source file. For example, as Sofiane points out, ".section .text" tells the assembler to place what follows in the .text segment of the object code. I recommend reading http://en.wikipedia.org/wiki/Assembly_language

(I recognize that computer programming language terminology is largely English-centric, and that English is not the native language for (probably) most programmers in the world.)

--Bob Plantz

________________________________________
From: linux-assembly-owner@vger.kernel.org [linux-assembly-owner@vger.kernel.org] on behalf of Sofiane Akermoun [akersof@gmail.com]
Sent: Sunday, March 03, 2013 10:06 PM
To: ishare
Cc: linux-assembly@vger.kernel.org
Subject: Re: how to use .section command in asm code?

This is not a command.
.section is a keyword related to your assembler syntax, probably gas
in your case.
A binary should have a section containing the code.
with gas we declare it with: .section .text with nasm we declare it
with section .text
We write below this tag all the executable code.
A binary could need data of course we create a section containing all
the data with .section .data with gas.
Your asm source file should be like this:
#some headers here
.section .data
    #initialized data here

.section .text
    global _start
    _start:
           #the executable code

regards,

Sofiane Akermoun


2013/3/3 ishare <june.tune.sea@gmail.com>:
>
> can .section command be used in asm code to define a section ?
>
> is there any examples?
>
>
> thanks!
> --
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
Sofiane AKERMOUN
akersof@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2013-03-04 15:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-03 19:50 how to use .section command in asm code? ishare
2013-03-04  6:06 ` Sofiane Akermoun
2013-03-04 15:31   ` Robert Plantz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6E3CF6FDA48EC747AAAE0EAEDF16EFF802C7E62F@coronet.solar.sonoma.edu \
    --to=plantz@sonoma.edu \
    --cc=akersof@gmail.com \
    --cc=june.tune.sea@gmail.com \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).