Fix phantom TEXTREL in libcoreclr.so (dotnet/coreclr#8347)
authorJan Vorlicek <janvorli@microsoft.com>
Tue, 29 Nov 2016 14:12:02 +0000 (15:12 +0100)
committerJan Kotas <jkotas@microsoft.com>
Tue, 29 Nov 2016 14:12:02 +0000 (06:12 -0800)
This change fixes the problem where scanelf tool reported that libcoreclr.s
contains TEXTRELs, however it was unable to find any.
It turns out there actually were TEXTRELs, but not in the program code or
program data, but rather in the DWARF tables. The NESTED_ENTRY macro for
ARM64 and AMD64 uses .cfi_personality with encoding 0, which means
absolute address. This is the source of the TEXTREL.
Changing the encoding to 0x1b - DW_EH_PE_pcrel | DW_EH_PE_sdata4 fixes the
problem - the scanelf tool no longer reports any TEXTRELs in libcoreclr.so.

Commit migrated from https://github.com/dotnet/coreclr/commit/a60661ea96f6760d6cfd8e1e86c370f7e7052ed0

src/coreclr/src/pal/inc/unixasmmacrosamd64.inc
src/coreclr/src/pal/inc/unixasmmacrosarm64.inc

index f221b44..c3321ce 100644 (file)
@@ -8,7 +8,7 @@
 #if defined(__APPLE__)
         .cfi_personality 0x9b, C_FUNC(\Handler) // 0x9b == DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4
 #else
-        .cfi_personality 0, C_FUNC(\Handler) // 0 == DW_EH_PE_absptr
+        .cfi_personality 0x1b, C_FUNC(\Handler) // 0x1b == DW_EH_PE_pcrel | DW_EH_PE_sdata4
 #endif
         .endif
 .endm
index ae60db4..6014205 100644 (file)
@@ -5,7 +5,7 @@
 .macro NESTED_ENTRY Name, Section, Handler
         LEAF_ENTRY \Name, \Section
         .ifnc \Handler, NoHandler
-        .cfi_personality 0, C_FUNC(\Handler) // 0 == DW_EH_PE_absptr
+        .cfi_personality 0x1b, C_FUNC(\Handler) // 0x1b == DW_EH_PE_pcrel | DW_EH_PE_sdata4
         .endif
 .endm