]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Redefine ASM_PREFERRED_EH_DATA_FORMAT for ppc[64]-vxworks
authorOlivier Hainque <hainque@adacore.com>
Sat, 20 Apr 2024 11:43:56 +0000 (08:43 -0300)
committerOlivier Hainque <hainque@adacore.com>
Tue, 21 Oct 2025 08:10:30 +0000 (08:10 +0000)
This patch redefines ASM_PREFERRED_EH_DATA_FORMAT from the
otherwise inherited linux variant, preventing DW_EH_PE_indirect
in 64bit DKMs, where they are not strictly
needed and where the runtime load could resolve the DW.refs to
symbols of the same name within a different DKM loaded previously.

gcc/
* config/rs6000/vxworks.h (ASM_PREFERRED_EH_DATA_FORMAT):
Redefine.

gcc/config/rs6000/vxworks.h

index 9eb074be31a89e9ccaf2eae6932c262ef66f3a3d..13c706b6114203a5662e75a637fa9c6213b9c9a8 100644 (file)
@@ -290,5 +290,21 @@ along with GCC; see the file COPYING3.  If not see
    trigger visible link errors (hence remain harmless) if the support isn't
    really there.  */
 
+/* Select a format to encode pointers in exception handling data.  CODE
+   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
+   true if the symbol may be affected by dynamic relocations.
+
+   This is essentially the linux64.h version with an extra guard on
+   TARGET_VXWORKS_RTP to avoid DW_EH_PE_indirect in 64bit DKMs as they
+   could result in references from one DKM to resolve to symbols exposed
+   by a previsouly loaded DKM even if the symbol is also provided by the
+   DKM where the reference takes place.  */
+#undef ASM_PREFERRED_EH_DATA_FORMAT
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
+  ((TARGET_64BIT && TARGET_VXWORKS_RTP) || flag_pic                    \
+   ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel              \
+      | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4))            \
+   : DW_EH_PE_absptr)
+
 #endif /* TARGET_VXWORKS7 */