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.