Macros | |
#define | PW_MUST_PLACE(isection) _PW_MUST_PLACE(isection, __section_place_, __LINE__) |
#define PW_MUST_PLACE | ( | isection | ) | _PW_MUST_PLACE(isection, __section_place_, __LINE__) |
PW_MUST_PLACE is a macro intended for use in linker scripts to ensure inputs are non-zero sized.
Say you want to place a specific object file into a particular section. You can reference it by file path like:
This works but is fragile as it will silently break if the filename or path changes. Use PW_MUST_PLACE to get a linker assertion if the input is empty.
If the wildcard match fails PW_MUST_PLACE will generate an error telling you which input had no symbols.
This could be because you had a typo, the path changed, or the symbols were dropped due to linker section garbage collection.In the latter case, you can choose to add KEEP()
around your input to prevent garbage collection.