AT&T assembler receives PIC flags, but does not support them for all architectures
According to the line of CMakeASM-ATTInformation.cmake
show below, AT&T assembler dialect is called with compilation flags. PIC flags (-fPIC -fpic) defined by POSITION_INDEPENDENT_CODE
are propagated into these flags as well. The problem is that not all GNU AS architectures accept -fPIC as a valid flag. Particularly, -fPIC is not supported by GNU AS for x86_64. As a result, AT&T assembly files could not be included into a shared library generated by CMake. As a workaround, AT&T object could be moved into a separate static library and linked against it.
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")