https://gcc.gnu.org/g:a3c0112f554c676f6155db75ccab9d8393ed763c

commit r16-4533-ga3c0112f554c676f6155db75ccab9d8393ed763c
Author: Olivier Hainque <[email protected]>
Date:   Sat Apr 20 08:43:56 2024 -0300

    Redefine ASM_PREFERRED_EH_DATA_FORMAT for ppc[64]-vxworks
    
    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.

Diff:
---
 gcc/config/rs6000/vxworks.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gcc/config/rs6000/vxworks.h b/gcc/config/rs6000/vxworks.h
index 9eb074be31a8..13c706b61142 100644
--- a/gcc/config/rs6000/vxworks.h
+++ b/gcc/config/rs6000/vxworks.h
@@ -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 */

Reply via email to