mirror of
https://github.com/ares-emulator/ares.git
synced 2026-10-12 02:11:04 +00:00
When placing co_swap_function byte array into the text section, libco uses the trick of appending a # to the section name. This name string is passed directly to the generated assembly and the # is treated as comment token by the GNU assembler. This is a hack to avoid a warning about changed section attributes. This hack doesn't work with other compilers like Clang or TinyCC, but unlike GCC they don't require such hacks. I've added some compile time checks around the hack to try to isolate it to GCC and allow other compilers to see the unmodified section name. Validated on the following OSes/architectures/compilers: - Windows/amd64: gcc, clang, cl, clang-cl, tcc - Windows/aarch64: clang, cl, clang-cl - Linux/amd64: gcc, clang, tcc[1] - Linux/aarch64: gcc, clang, tcc[1] - macOS/aarch64: gcc, clang [1] TCC only works with a fix to glibc headers that was only made very recently. Without it, you have to #undef __attribute__ after including glibc headers.