Re: [patch] RFC asan support for i?86/x86_64-*freebsd*

2015-12-01 Thread Andreas Tobler

Hi!

On 01.12.15 13:22, Uros Bizjak wrote:


2015-11-29  Andreas Tobler  

* config/i386/i386.h: Define two new macros:
SUBTARGET_SHADOW_OFFSET_64 and SUBTARGET_SHADOW_OFFSET_32.
* config/i386/i386.c (ix86_asan_shadow_offset): Use these macros.
* config/i386/darwin.h: Override the SUBTARGET_SHADOW_OFFSET_64
macro.
* config/i386/freebsd.h: Override the SUBTARGET_SHADOW_OFFSET_64
and the SUBTARGET_SHADOW_OFFSET_32 macro.
* config/freebsd.h (LIBASAN_EARLY_SPEC): Define.
(LIBTSAN_EARLY_SPEC): Likewise.
(LIBLSAN_EARLY_SPEC): Likewise.


IMO, there is no compelling reason for _64 and _32 subtargets split,
especially since it depends on TARGET_LP64, not on the usual
TARGET_64BIT. Due to this, I'd rather introduce only
TARGET_SHADOW_OFFSET, like:

#define TARGET_SHADOW_OFFSET \
   (TARGET_LP64 ? HOST_WIDE_INT_C (0x7fff8000) : HOST_WIDE_INT_1 << 29)

(and similar for other targets).


Thank you for the feedback. I put your suggestion into my local tree and 
the results are equal. Thanks, diff reduced :)


Andreas



Re: [patch] RFC asan support for i?86/x86_64-*freebsd*

2015-12-01 Thread Uros Bizjak
Hello!

> 2015-11-29  Andreas Tobler  
>
> * config/i386/i386.h: Define two new macros:
> SUBTARGET_SHADOW_OFFSET_64 and SUBTARGET_SHADOW_OFFSET_32.
> * config/i386/i386.c (ix86_asan_shadow_offset): Use these macros.
> * config/i386/darwin.h: Override the SUBTARGET_SHADOW_OFFSET_64
> macro.
> * config/i386/freebsd.h: Override the SUBTARGET_SHADOW_OFFSET_64
> and the SUBTARGET_SHADOW_OFFSET_32 macro.
> * config/freebsd.h (LIBASAN_EARLY_SPEC): Define.
> (LIBTSAN_EARLY_SPEC): Likewise.
> (LIBLSAN_EARLY_SPEC): Likewise.

IMO, there is no compelling reason for _64 and _32 subtargets split,
especially since it depends on TARGET_LP64, not on the usual
TARGET_64BIT. Due to this, I'd rather introduce only
TARGET_SHADOW_OFFSET, like:

#define TARGET_SHADOW_OFFSET \
  (TARGET_LP64 ? HOST_WIDE_INT_C (0x7fff8000) : HOST_WIDE_INT_1 << 29)

(and similar for other targets).

Uros.


Re: [patch] RFC asan support for i?86/x86_64-*freebsd*

2015-11-30 Thread Jeff Law

On 11/29/2015 03:10 PM, Andreas Tobler wrote:

All,

this patch adds support for asan for i?86/x86_64-*freebsd*.

Test results can be found on the list.

These modifications belong only to gcc. There is one modification to
asan/asan_linux.cc, this one is sent upstream. Until this one is in, my
patch is on hold.

One thing to note, FreeBSD does not need to link against -ldl. That is
why I added an extra config check.

But nevertheless I'd like to get some comments on the patch.

Thanks to Jakub and Dan McGregor.

Thanks,
Andreas


2015-11-29  Andreas Tobler  

 * config/i386/i386.h: Define two new macros:
 SUBTARGET_SHADOW_OFFSET_64 and SUBTARGET_SHADOW_OFFSET_32.
 * config/i386/i386.c (ix86_asan_shadow_offset): Use these macros.
 * config/i386/darwin.h: Override the SUBTARGET_SHADOW_OFFSET_64
 macro.
 * config/i386/freebsd.h: Override the SUBTARGET_SHADOW_OFFSET_64
 and the SUBTARGET_SHADOW_OFFSET_32 macro.
 * config/freebsd.h (LIBASAN_EARLY_SPEC): Define.
 (LIBTSAN_EARLY_SPEC): Likewise.
 (LIBLSAN_EARLY_SPEC): Likewise.

2015-11-29  Andreas Tobler  

 * configure.ac: Replace the hard-coded -ldl requirement for
 link_sanitizer_common with a configure time check for -ldl.
 * configure: Regenerate.
 * configure.tgt: Add x86_64- and i?86-*-freebsd* targets.
The configury bits are fine.  Uros would own review on the x86 specific 
changes.


jeff