On 11/14/18 4:05 AM, Jozef Lawrynowicz wrote:
> Use of the patchable_function_entry attribute when the pointer mode is a
> partial int mode can cause a segfault.
> The handler for this attribute tries to write out the assembler directive
> for an integer with bytesize POINTER_SIZE_UNITS, so if this is not 2, 4, 8 or
> 
> 16 NULL is returned, resulting in a segfault.
> 
> This was observed on msp430-elf with the large memory model, where 
> POINTER_SIZE
> 
> is 20, and so POINTER_SIZE_UNITS is 3.
> 
> Fixed by implementing TARGET_ASM_{,UN}ALIGNED_PSI_OP, and extending "struct
> asm_int_op".
> 
> For completeness I added the hooks for PDImode (used by bfin) and PTImode 
> (used
> 
> by rs6000). However, these aren't tied to any real types as they are used
> for register modes, so I can't see this patch having any effect for these
> targets. Since there's no way to represent these modes in memory, the compiler
> 
> will never need to write out an assembler directive for them.
> 
> Successfully bootstrapped and regtested current trunk for x86_64-pc-linux-gnu
> 
> and regtested msp430-elf with -mlarge.
> 
> Ok for trunk?
> 
> 
> 0001-Implement-TARGET_ASM_-UN-ALIGNED_P-S-D-T-I_OP.patch
> 
> From ffff48890bd01668f68bafbd94556c9754bf2406 Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <joze...@mittosystems.com>
> Date: Thu, 8 Nov 2018 13:42:27 +0000
> Subject: [PATCH] Implement TARGET_ASM_{,UN}ALIGNED_P{S,D,T}I_OP
> 
> 2018-11-14  Jozef Lawrynowicz  <joze...@mittosystems.com>
> 
>       PR target/87927
> 
>       gcc/ChangeLog:
> 
>       * target-def.h: Initialize TARGET_ASM_{,UN}ALIGNED_P{S,D,T}I_OP.
>       Add them to the TARGET_ASM_{,UN}ALIGNED_INT_OP structs.
>       * target.def: Enumerate TARGET_ASM_{,UN}ALIGNED_P{S,D,T}I_OP in
>       the byte_op hook.
>       * target.h: Add psi, pdi, pti to struct asm_int_op definition.
>       * targhooks.c (default_print_patchable_function_entry): Assert
>       asm_int_op does not return a NULL string.
>       * varasm.c (integer_asm_op): Return the op for a partial int type
>       when the requested size does not correspond to an integer type.
>       * config/msp430/msp430.c: Initialize TARGET_ASM_{,UN}ALIGNED_PSI_OP.
OK
jeff

Reply via email to