public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Iyer, Balaji V" <balaji.v.iyer@intel.com>
To: "'gcc@gcc.gnu.org'" <gcc@gcc.gnu.org>
Subject: Question about Offsets
Date: Wed, 12 Oct 2011 04:21:00 -0000	[thread overview]
Message-ID: <2950715866004049A240A2F9BB410E7315F4296C1A@azsmsx502.amr.corp.intel.com> (raw)

Hello Everyone,
	This question is regarding adding offsets into a user-defined section into gcc.

Let’s say I have a section called “my_section” and I want the section to have some sub-sections (e.g. a string table). One of the fields in my section is the offset to the next header. How do I represent this in GCC? I think I have to do it in RTL expressions (RTX).

Here is an example of what I am trying to do (please note that what I have below is a semi-pseudo code). 

.section “.my_section”

START_LABEL:   
# The next 5 lines are headers
	.ascii “My Section Magic Header”
	.int STRING_TABLE_LABEL – START_LABEL      ⇐====== HOW TO DO THIS? I WOULD LIKE THE LINKER TO THEN CONVERT IT TO A NUMBER.
	.int  10 <SIZE OF STRING TABLE>
	…                      # Here I have other data which could be of variable length

STRING_TABLE_LABEL:
	.string “HELLO”
	.string “WORLD”

.end “my_section”
.section “.text”
……




Thanks,

Balaji V. Iyer.

                 reply	other threads:[~2011-10-12  0:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=2950715866004049A240A2F9BB410E7315F4296C1A@azsmsx502.amr.corp.intel.com \
    --to=balaji.v.iyer@intel.com \
    --cc=gcc@gcc.gnu.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).