diff mbox

AIX EH data format

Message ID CAGWvnymkas4bKa4p8irju4bb7p-87J3B8axZF-wigxoDMEvvXA@mail.gmail.com
State New
Headers show

Commit Message

David Edelsohn Oct. 7, 2015, 6:35 p.m. UTC
The recent patches to move GCC exception handling tables on AIX to
read-only data changed the EH data format from absolute pointers to
data-relative or pc-relative, but the offset was encoded as 32 bit,
which isn't robust in 64-bit mode.  This patch adjusts the definition
to selects the encoding based on 32 bit versus 64 bit mode.

I would appreciate any additional eyes on the new design to check if
Andrew and I missed anything.

Bootstrapped on powerpc-ibm-aix7.1.0.0 and tested with g++.dg/eh

Thanks, David

* config/rs6000/xcoff.h (ASM_PREFERRED_EH_DATA_FORMAT): Use 64-bit
encoding in 64-bit mode.

Comments

Richard Henderson Oct. 7, 2015, 8:13 p.m. UTC | #1
On 10/08/2015 05:35 AM, David Edelsohn wrote:
> The recent patches to move GCC exception handling tables on AIX to
> read-only data changed the EH data format from absolute pointers to
> data-relative or pc-relative, but the offset was encoded as 32 bit,
> which isn't robust in 64-bit mode.  This patch adjusts the definition
> to selects the encoding based on 32 bit versus 64 bit mode.
>
> I would appreciate any additional eyes on the new design to check if
> Andrew and I missed anything.
>
> Bootstrapped on powerpc-ibm-aix7.1.0.0 and tested with g++.dg/eh
>
> Thanks, David
>
> * config/rs6000/xcoff.h (ASM_PREFERRED_EH_DATA_FORMAT): Use 64-bit
> encoding in 64-bit mode.

The rs6000 port doesn't have any kind of "code model" to select the size of the 
application here?

I guess considering the way the aix calling convention uses its TOC slices you 
wouldn't have needed one yet.  Perhaps eating the extra space is the most robust.


r~
diff mbox

Patch

Index: xcoff.h
===================================================================
--- xcoff.h     (revision 228568)
+++ xcoff.h     (working copy)
@@ -307,8 +307,8 @@ 
    so use addressing relative to the data segment.
  */
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
-  ((GLOBAL) ? (DW_EH_PE_indirect | DW_EH_PE_datarel | DW_EH_PE_sdata4) \
-           : (DW_EH_PE_pcrel | DW_EH_PE_sdata4))
+  (((GLOBAL) ? DW_EH_PE_indirect | DW_EH_PE_datarel : DW_EH_PE_pcrel) \
+   | (TARGET_64BIT ? DW_EH_PE_sdata8 : DW_EH_PE_sdata4))

 #define EH_FRAME_THROUGH_COLLECT2 1
 #define EH_TABLES_CAN_BE_READ_ONLY 1