public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Question about Offsets
@ 2011-10-12  4:21 Iyer, Balaji V
  0 siblings, 0 replies; only message in thread
From: Iyer, Balaji V @ 2011-10-12  4:21 UTC (permalink / raw)
  To: 'gcc@gcc.gnu.org'

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-12  0:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-12  4:21 Question about Offsets Iyer, Balaji V

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).