[Thumb] Baseline test for incorrect relocation with -ffunction-sections
When calling a dso_local function, we end up creating a call against the .Lfoo$local label. This might be converted to a relocation against a section if there is such a matching one (which is a lot more likely with -ffunction-sections) and then the LSB (Thumb flag) will be lost. I originally noticed this with Morello LLVM (which uses the LSB to indicate a C64 encoding mode function). The missing LSB meant that ld.lld would insert a thunk that switches encoding mode which then resulted in errors at runtime since functions were being entered with the wrong encoding mode. Since the Morello backend is not upstream, I looked if any in-tree backends could also be affected by the missing STT_FUNC flag and noticed that Thumb is also affected (although the bug is rather difficult to trigger - it currently requires inline assembly). Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D131432
Loading
Please register or sign in to comment