From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29455 invoked by alias); 14 Aug 2015 15:25:57 -0000 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 Received: (qmail 29429 invoked by uid 48); 14 Aug 2015 15:25:55 -0000 From: "andrew.n.senkevich at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67215] -fno-plt needs improvements for x86 Date: Fri, 14 Aug 2015 15:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: andrew.n.senkevich at gmail dot com X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-08/txt/msg00984.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67215 --- Comment #4 from Andrew Senkevich --- -bash-4.2$ cat test.c extern char* mem(int); char* arr[32]; void proc(void) { int i; for (i=0;i<32;i++) arr[i] = mem(128); } gcc -pie -fpie -fno-plt -O2 -S test.c -o test_32.S -m32 gcc -pie -fpie -fno-plt -O2 -S test.c -o test_64.S -bash-4.2$ cat test_32.S . . . proc: .LFB0: .cfi_startproc call __x86.get_pc_thunk.ax addl $_GLOBAL_OFFSET_TABLE_, %eax pushl %edi .cfi_def_cfa_offset 8 .cfi_offset 7, -8 pushl %esi .cfi_def_cfa_offset 12 .cfi_offset 6, -12 pushl %ebx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movl arr@GOT(%eax), %ebx movl mem@GOT(%eax), %esi leal 128(%ebx), %edi .p2align 4,,10 .p2align 3 .L2: subl $12, %esp .cfi_def_cfa_offset 28 addl $4, %ebx pushl $128 .cfi_def_cfa_offset 32 call *%esi movl %eax, -4(%ebx) addl $16, %esp .cfi_def_cfa_offset 16 cmpl %edi, %ebx jne .L2 popl %ebx .cfi_restore 3 .cfi_def_cfa_offset 12 popl %esi .cfi_restore 6 .cfi_def_cfa_offset 8 popl %edi .cfi_restore 7 .cfi_def_cfa_offset 4 ret .cfi_endproc .LFE0: .size proc, .-proc . . . -bash-4.2$ cat test_64.S . . . proc: .LFB0: .cfi_startproc pushq %r12 .cfi_def_cfa_offset 16 .cfi_offset 12, -16 pushq %rbp .cfi_def_cfa_offset 24 .cfi_offset 6, -24 pushq %rbx .cfi_def_cfa_offset 32 .cfi_offset 3, -32 movq arr@GOTPCREL(%rip), %rbx movq mem@GOTPCREL(%rip), %rbp leaq 256(%rbx), %r12 .p2align 4,,10 .p2align 3 .L2: movl $128, %edi addq $8, %rbx call *%rbp movq %rax, -8(%rbx) cmpq %r12, %rbx jne .L2 popq %rbx .cfi_def_cfa_offset 24 popq %rbp .cfi_def_cfa_offset 16 popq %r12 .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE0: .size proc, .-proc . . .