/*! @file libsaio/machsections.h @copyright David Elliott @abstract Various macros to allow usage of __LOSEG to be turned on/off @discussion The libsaio library is used not only by boot2 but also by boot1u and potentially by other booter-type programs. Until those programs build processes make the necessary changes to ensure that __LOSEG is linked before __TEXT it is actually detrimental to output code/data into the non-standard section. One thing all booters aside from boot2 have in common is that they all build libsaio's asm.s and bios.s outside of libsaio proper. Thus you should only use these macros from these two libsaio files and no others. */ #ifndef _LIBSAIO_LOSEGMENT_H__ #define _LIBSAIO_LOSEGMENT_H__ // Default to using __LOSEG,__text for second-stage bootloader // Can be overridden with -D on the compiler command-line. #ifndef USE_LOTEXT_SEGMENT # ifdef BOOT1 # define USE_LOTEXT_SEGMENT 0 # else # define USE_LOTEXT_SEGMENT 1 # endif #endif // Default to using __LOSEG,__data for second-stage bootloader // Can be overridden with -D on the compiler command-line. #ifndef USE_LODATA_SEGMENT # ifdef BOOT1 # define USE_LODATA_SEGMENT 0 # else # define USE_LODATA_SEGMENT 1 # endif #endif /* Switch SECTION_FOR_LODATA_OR_DATA */ #if USE_LODATA_SEGMENT #define SECTION_FOR_LODATA_OR_DATA \ .section __LOSEG, __data #define SECTION_FOR_LOCONST_OR_CONST .section __LOSEG, __const #define SECTION_ATTR_FOR_LODATA_OR_DATA __attribute__((section("__LOSEG,__data"))) #else #define SECTION_FOR_LODATA_OR_DATA \ .data #define SECTION_FOR_LOCONST_OR_CONST .const #define SECTION_ATTR_FOR_LODATA_OR_DATA #endif /* Switch SECTION_FOR_LOTEXT_OR_TEXT */ #if USE_LOTEXT_SEGMENT #define SECTION_FOR_LOTEXT_OR_TEXT \ .section __LOSEG, __text #define SECTION_ATTR_FOR_LOTEXT_OR_TEXT __attribute__((section("__LOSEG,__text"))) #else #define SECTION_FOR_LOTEXT_OR_TEXT \ .text #define SECTION_ATTR_FOR_LOTEXT_OR_TEXT #endif #endif /* ndef _LIBSAIO_LOSEGMENT_H__ */