How can one link a variable to a static pre-defined location when using clang/LLVM? For example, some compilers support the following syntax:
static const uint8_t myVar __attribute__ ((at(MY_LOCATION))) = 0x11;
So far I've found that global variables and functions support the section attribute: http://clang.llvm.org/docs/AttributeReference.html#id38 but I'm not sure if that's what I need to use and/or how to make use of it.
The use case for this is that the output of the toolchain is a flat binary that gets loaded into the devices memory. Certain scripts or other tools may expect to find certain attributes of that binary at a fixed offset in the binary image. This is particularly common in the embedded systems world.
EDIT: I also found this https://github.com/llvm-mirror/clang/blob/master/test/Sema/attr-section.c which appears to be a unit testing framework for that attribute. The passing cases have two strings, I don't really understand why there isn't just a single string for a section name.