From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31265 invoked by alias); 8 Feb 2013 09:02:55 -0000 Received: (qmail 30944 invoked by uid 48); 8 Feb 2013 09:02:26 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/55309] gcc's address-sanitizer 66% slower than clang's Date: Fri, 08 Feb 2013 09:02:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg00762.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55309 --- Comment #27 from Jakub Jelinek 2013-02-08 09:02:23 UTC --- Zero based offset has the big disadvantage of imposing big requirements on the executable. Could we on x86_64 think about mem_to_shadow(x) (x >> 3) + 0x7fff8000 (note, not |, but +)? Then instead of something like: movq %rdi, %rdx movabsq $17592186044416, %rax shrq $3, %rdx cmpb $0, (%rdx,%rax) jne .L5 movq (%rdi), %rax ret .L5: pushq %rax call __asan_report_load8 we could emit: movq %rdi, %rdx shrq $3, %rdx cmpb $0, 0x7fff8000(%rdx) jne .L5 movq (%rdi), %rax ret .L5: pushq %rax call __asan_report_load8 which is 7 bytes shorter sequence, without the need of an extra register and the not so cheap movabs insn. By forcing PIE for everything, you are forcing the PIC overhead of unnecessary extra indirections in many places (and, on non-x86_64 usually it is even much more expensive).