This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]