Re: Non-booting current Linus' tree

From: Andy Lutomirski
Date: Sun Jul 05 2015 - 16:01:55 EST


On 07/03/2015 02:40 PM, Linus Torvalds wrote:
> On Fri, Jul 3, 2015 at 8:23 AM, Jan Kara <jack@xxxxxxx> wrote:
>>
>> Because the address isn't 32-byte aligned (which I assume is the
>> requirement from looking into the code). So clearly my gcc messed up and
>> miscompiled the thing by ignoring the alignment attribute.
>
> Well, it's probably a mistake to begin with to expect gcc to get stack
> alignment right. Especially since we tell gcc to not align the stack
> as much as it usually wants to with -mpreferred-stack-boundary=2.
>

Are you sure?

The 64-bit part of arch/x86/Makefile contains:

# Use -mpreferred-stack-boundary=3 if supported.
KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)

but make V=1 isn't showing -mpreferred-stack-boundary=3. This may be
because:

error: -mpreferred-stack-boundary=3 is not between 4 and 12
extern int bar(const char *);
^

I found:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383

and, indeed, -mno-sse -mpreferred-stack-boundary=3 is accepted. This
make me think that the makefile is broken -- cc-option isn't working
because it doesn't check -mpreferred-stack-boundary in conjunction with
-mno-sse.

Given that -mpreferred-stack-boundary=3 doesn't appear to being set, I
think this is really our bug: our asm code makes no effort to align the
stack to a 16-byte boundary as required by the ABI, and we're not
overriding the ABI correctly.

I'll send a patch for the Makefile issue.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/