[Driver] Pass --target2= to linker from baremetal toolchain
According to the GNU ld manual https://sourceware.org/binutils/docs/ld/ARM.html#ARM the R_ARM_TARGET2 relocation (used in exception handling tables) is treated differently depending on the target. By default, LLD treats R_ARM_TARGET2 as R_ARM_GOT_PREL (--target2=got-rel), which is correct for Linux but not for embedded targets. This patch adds --target2=rel to linker options in the baremetal toolchain driver so that on baremetal targets, R_ARM_TARGET2 is treated as R_ARM_REL32. Such behavior is compatible with GNU ld and unwinding libraries (e.g., libuwind). Reviewed By: peter.smith, phosek Differential Revision: https://reviews.llvm.org/D149458
Loading
Please sign in to comment