I fixed the problem with variable access between sections; it was simply a problem of the linker not knowing about the section I was trying to define.
The linker uses an external file with the extension ".ld" to determine how to order sections in the final binary; this file is simply composed of a collection of name-value pairs; names define section names, and values are memory addresses corresponding to where in the binary we want the section to be placed.
I was trying to define a section named ".hello", but this wasn't defined in the file, so when it came time to try to find variables from it, their addresses were completely wrong.
I put in some code to deal with sections that aren't defined in the file; if we encounter a section that has no definition, it is simply appended to the end of the binary...a simple and effective fix.
I started work on structs today, more to come later.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment