This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Question about Offsets
- From: "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>
- To: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Tue, 11 Oct 2011 17:24:03 -0700
- Subject: Question about Offsets
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.