Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140511190320.GV26358@brightrain.aerifal.cx>
Date: Sun, 11 May 2014 15:03:20 -0400
From: Rich Felker <dalias@...c.org>
To: James Cloos <cloos@...loos.com>
Cc: Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
	musl@...ts.openwall.com
Subject: Re: Broken GCC versions: 4.8.2 and 4.9.0

On Sun, May 11, 2014 at 02:46:51PM -0400, James Cloos wrote:
> What does the wrong assembly of your test code look like?

xorl %eax,%eax ; ret

> The assembly I get looks reasonable, in that it always references foo:
> 
> The O3 version is:
> 
> 	.file	"test.c"
> 	.text
> 	.p2align 5,,31
> 	.globl	bar
> 	.type	bar, @function
> bar:
> ..LFB0:
> 	.cfi_startproc
> 	movl	foo(%rip), %edx
> 	xorl	%eax, %eax
> 	testl	%edx, %edx
> 	setne	%al
> 	ret
> 	.cfi_endproc
> ..LFE0:
> 	.size	bar, .-bar
> 	.section	.rodata
> 	.align 4
> 	.type	dummy, @object
> 	.size	dummy, 4
> dummy:
> 	.zero	4
> 	.weak	foo
> 	.set	foo,dummy
> 	.ident	"GCC: (Gentoo 4.8.2-r1 p1.4-ssptest, pie-0.5.9-ssptest) 4.8.2"
> 	.section	.note.GNU-stack,"",@progbits
> 
> Every version tests foo(%rip) and gets the result into %rax.
> 
> The ia32, arm32 and arm64 assembly looks right, too.
> 
> Perhaps distribution patches affect this?

I've tested it on gcc.godbolt.org and others have tested with local
gcc 4.8.2 and 4.9.0, probably distro-provided (I didn't ask).

I wonder if the broken GCC is using isl/cloog (some third-party
optimization library they hacked into gcc that's used only if it's
available). That could explain it, especially since people who are
building their own toolchains against musl do not seem to be
experiencing the problem.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.