[lkml]   [2010]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subjectgcc 4.5.1 / as miscompiling drivers/char/i8k.c ?

    After upgrading my Dell laptop, both OS+kernel the i8k interface was giving
    nonsensical output. As it turned out it's not the kernel but compiler
    upgrade which broke this.

    Guys at Archlinux have found the underlying cause (but don't seem to have
    submitted a patch yet):
    gcc seems to optimize the assembly statements away.

    And indeed, applying this patch makes the i8k interface work again,
    i.e. replacing the asm(..) construct by asm volatile(..)

    --- i8k.c.ORIG 2010-08-02 17:20:46.000000000 +0200
    +++ i8k.c 2010-10-30 13:03:07.000000000 +0200
    @@ -119,7 +119,7 @@
    int eax = regs->eax;

    #if defined(CONFIG_X86_64)
    - asm("pushq %%rax\n\t"
    + asm volatile("pushq %%rax\n\t"
    "movl 0(%%rax),%%edx\n\t"
    "pushq %%rdx\n\t"
    "movl 4(%%rax),%%ebx\n\t"
    @@ -145,7 +145,7 @@
    : "a"(regs)
    : "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
    - asm("pushl %%eax\n\t"
    + asm volatile("pushl %%eax\n\t"
    "movl 0(%%eax),%%edx\n\t"
    "push %%edx\n\t"
    "movl 4(%%eax),%%ebx\n\t"

    gcc version:
    Reading specs from /usr/lib/gcc/i486-slackware-linux/4.5.1/specs
    Target: i486-slackware-linux
    Configured with: ../gcc-4.5.1/configure --prefix=/usr --libdir=/usr/lib
    --mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap
    --enable-languages=ada,c,c++,fortran,java,objc --enable-threads=posix
    --enable-checking=release --with-system-zlib
    --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp
    --with-gnu-ld --verbose --with-arch=i486 --target=i486-slackware-linux
    --build=i486-slackware-linux --host=i486-slackware-linux
    Thread model: posix
    gcc version 4.5.1 (GCC)

    as version:
    GNU assembler (Linux/GNU Binutils)
    Copyright 2010 Free Software Foundation, Inc.
    This program is free software; you may redistribute it under the terms of
    the GNU General Public License version 3 or later.
    This program has absolutely no warranty.
    This assembler was configured for a target of `i486-slackware-linux'.

    I would be happy to submit a proper patch if I new this is actually the
    correct fix, also there might be other places in the kernel source
    suffering from this ??

    Jim Bos

     \ /
      Last update: 2010-11-06 12:23    [W:0.022 / U:2.604 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site