toolchain: gcc: squashed fixes related to optimized toolchain

Makefile: add Linaro goddess optimizations

toolchain: linaro: Fix a bunch of warnings and errors

Change-Id: I74dc4a9a1c46a9d84d2a592d24a905b21aa87a15

toolchain: linaro: Fix a bunch of warnings and errors II

toolchain: linaro: fix uninitialized kbuf in sysctl.c for linaro optimizations

Change-Id: Idd983e621b67d4016ff113b18de8f8a59bc70c85

toolchain: linaro: fix warning subbuf.pages may be used uninitialized

Change-Id: I0aaa7ccb4a29ec58d7d05e24c19f22c8cc50c8cb

toolchain: linaro: fix ICE in fs/fs-writeback.c with gcc4.7

fs/fs-writeback.c: In function 'bdi_writeback_thread':
fs/fs-writeback.c:993:1: internal compiler error: in push_minipool_fix, at config/arm/arm.c:13180
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [fs/fs-writeback.o] Error 1
make: *** [fs] Error 2

$ arm-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=/home/showp1984/WORK/toolchain/android-toolchain-eabi/bin/arm-eabi-gcc
COLLECT_LTO_WRAPPER=/home/showp1984/WORK/toolchain/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.7.2/lto-wrapper
Target: arm-eabi
Configured with: /mnt/jenkins/workspace/linaro-android_toolchain-4.7-2012.09/build/objdir/temp-src/gcc-linaro-4.7-2012.09/configure --prefix=/tmp/android-toolchain-eabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/mnt/jenkins/workspace/linaro-android_toolchain-4.7-2012.09/build/objdir/temp-install --with-mpfr=/mnt/jenkins/workspace/linaro-android_toolchain-4.7-2012.09/build/objdir/temp-install --with-mpc=/mnt/jenkins/workspace/linaro-android_toolchain-4.7-2012.09/build/objdir/temp-install --with-cloog=/mnt/jenkins/workspace/linaro-android_toolchain-4.7-2012.09/build/objdir/temp-install --with-ppl=/mnt/jenkins/workspace/linaro-android_toolchain-4.7-2012.09/build/objdir/temp-install --disable-ppl-version-check --disable-cloog-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --disable-nls --disable-libmudflap --disable-shared --disable-sjlj-exceptions --disable-libquadmath --disable-libitm --disable-libatomic --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --prefix=/tmp/android-toolchain-eabi --disable-docs --disable-nls --with-gcc-version=linaro-4.7-2012.09 --with-binutils-version=2.23.51.0.3 --with-gmp-version=5.0.5 --with-mpfr-version=3.1.1 --with-mpc-version=1.0 --target=arm-eabi --enable-threads --enable-tls --disable-libgomp --disable-libstdc__-v3 --disable-libitm --disable-libatomic
Thread model: single
gcc version 4.7.2 20120910 (prerelease) (Linaro GCC 4.7-2012.09)

Change-Id: Ibf92c1f6d844368fe9da52315a975dc1928962a7
Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

toolchain: linaro: Fix a bunch of warnings and errors -O3

- Fixes a bunch of initiliazed vars
- Compile lib/bitmap.c with -Os due of a bug
  Reference: https://code.google.com/p/bricked/source/detail?repo=tenderloin&r=cb8b2fe72f43c5146cb340abb2026810e50a23fc
- Disable array-bounds warning on staging prima driver

Change-Id: If17b3db45d8494bb5b5f8e13b8e8478e4fc9b10f

toolchain: linaro: fix warning: 'it.task' may be used uninitialized in this function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

toolchain: linaro: xc5000: fix warning 'quality' may be used uninitialized in this function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

toolchain: linaro: fix warning 'kernel_dev' may be used uninitialized in this function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

toolchain: linaro: fix 'warning: 'kernel_type' may be used uninitialized in this function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

toolchain: linaro: xc5000: fix warning 'frame_lines' may be used uninitialized in this function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

toolchain: linaro: l2cap_core: fix 'warning: '...' may be used uninitialized in this function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

fix: kernel/auditsc.c:927:23: warning: 'state' may be used uninitialized in this function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

drivers/media/common/tuners/xc5000: fix 'warning: 'lock_status' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

drivers/media/common/tuners/xc5000: fix 'warning: 'adc_envelope' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

drivers/media/common/tuners/xc4000: fix 'warning: '...' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

drivers/usb/host/ehci-sched: fix: 'warning: 'c_mask' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

fs/fuse/control: fix 'warning: 'val' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

fs/jbd2/journal: fix: 'warning: 'blocknr' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

net/unix/af_unix: fix: 'warning: '...' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

ARM: compressed/head.S: work around new binutils warning

In August 2012, Matthew Gretton-Dann checked a change
into binutils labelled "Error on obsolete & warn on
deprecated registers", apparently as part of ARMv8
support. Apparently, this was supposed to emit
the message "Warning: This coprocessor register access
is deprecated in ARMv8" when using certain mcr/mrc
instructions and building for ARMv8. Unfortunately,
the message that is actually emitted appears to be
'(null)', which is less helpful in comparison.

Even more unfortunately, this is biting us on
every single kernel build with a new gas, because
arch/arm/boot/compressed/head.S and some other files
in that directory are built with -march=all since
kernel commit 80cec14a8 "[ARM] Add -march=all to
assembly file build in arch/arm/boot/compressed"
back in v2.6.28.

This patch reverts Russell's nice solution and
replaces it with a more complex one that sprinkles
.arch statements inside of the head.S file in
functions that are executed in different architecture
levels, which seems to solve the original problem
just as well, and gets rid of the new one, too.

Without this patch, building anything results in:

arch/arm/boot/compressed/head.S: Assembler messages:
arch/arm/boot/compressed/head.S:565: Warning: (null)
arch/arm/boot/compressed/head.S:676: Warning: (null)
arch/arm/boot/compressed/head.S:698: Warning: (null)
arch/arm/boot/compressed/head.S:722: Warning: (null)
arch/arm/boot/compressed/head.S:726: Warning: (null)
arch/arm/boot/compressed/head.S:957: Warning: (null)
arch/arm/boot/compressed/head.S:996: Warning: (null)
arch/arm/boot/compressed/head.S:997: Warning: (null)
arch/arm/boot/compressed/head.S:1027: Warning: (null)
arch/arm/boot/compressed/head.S:1035: Warning: (null)
arch/arm/boot/compressed/head.S:1046: Warning: (null)
arch/arm/boot/compressed/head.S:1060: Warning: (null)
arch/arm/boot/compressed/head.S:1092: Warning: (null)
arch/arm/boot/compressed/head.S:1094: Warning: (null)
arch/arm/boot/compressed/head.S:1095: Warning: (null)
arch/arm/boot/compressed/head.S:1102: Warning: (null)
arch/arm/boot/compressed/head.S:1134: Warning: (null)

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Paul Beeler <sparksco@gmail.com>

return_address.c: Fix warning - TODO: return_address should use unwind tables

Added Linaro 4.8.2 Fixes

arch: boot: target armv7-a

makefile: add -DNDEBUG to KBUILD_CFLAGS

transport.c: Fix warning: 'midQ' may be used uninitialized in this function

epm_adc.c: Fix warning ‘*((void *)&adc_data+2)’ may be used uninitialized in this function

keystore.c: Fix warning ‘payload_len’ may be used uninitialized in this function

Fix gcc-4.9.0 miscompilation of load_balance() in scheduler

commit 2062afb4f804afef61cbe62a30cac9a46e58e067 upstream.

Michel Dänzer and a couple of other people reported inexplicable random
oopses in the scheduler, and the cause turns out to be gcc mis-compiling
the load_balance() function when debugging is enabled.  The gcc bug
apparently goes back to gcc-4.5, but slight optimization changes means
that it now showed up as a problem in 4.9.0 and 4.9.1.

The instruction scheduling problem causes gcc to schedule a spill
operation to before the stack frame has been created, which in turn can
corrupt the spilled value if an interrupt comes in.  There may be other
effects of this bug too, but that's the code generation problem seen in
Michel's case.

This is fixed in current gcc HEAD, but the workaround as suggested by
Markus Trippelsdorf is pretty simple: use -fno-var-tracking-assignments
when compiling the kernel, which disables the gcc code that causes the
problem.  This can result in slightly worse debug information for
variable accesses, but that is infinitely preferable to actual code
generation problems.

Doing this unconditionally (not just for CONFIG_DEBUG_INFO) also allows
non-debug builds to verify that the debug build would be identical: we
can do

    export GCC_COMPARE_DEBUG=1

to make gcc internally verify that the result of the build is
independent of the "-g" flag (it will make the compiler build everything
twice, toggling the debug flag, and compare the results).

Without the "-fno-var-tracking-assignments" option, the build would fail
(even with 4.8.3 that didn't show the actual stack frame bug) with a gcc
compare failure.

See also gcc bugzilla:

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

Reported-by: Michel Dänzer <michel@daenzer.net>
Suggested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Jakub Jelinek <jakub@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

makefile: add to -Os -> call cc-disable-warning,maybe-uninitialized

Fixes for kernel compile w/ 4.8

ppp: ppp_generic.c: warning code may be used uninitialized in this function

mach-msm: Kconfig: fix mistake into default settings

sabermod: toolchian: Fix unitialized variables when compile with 4.9

Change-Id: I874e273b691fb66d4eb769334a539de9db9b7834

sabermod: toolchian: Fix unitialized variables for hub.c

sabermod: makefile: reworked all flags for stability

* Thanks a lot @fusionjack

drivers/video/msm/mdss/mdss_mdp_util.c: fix: warning: array subscript is below array bounds

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c: fix: warning: array subscript is below array bounds

drivers/input/tablet/gtco.c: fix: 'warning: 'oldval[2]' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

Conflicts:
	Makefile
Implement kexec-hardboot

"Allows hard booting (i.e., with a full hardware reboot) to a kernel
previously loaded in memory by kexec.  This works around the problem of
soft-booted kernel hangs due to improper device shutdown and/or
reinitialization."
More info in /arch/arm/Kconfig.

Original author: Mike Kasick <mike@kasick.org>

Vojtech Bocek <vbocek@gmail.com>:
  I've ported it to hammerhead, it is based of my mako/grouper port, which is
  based of Asus TF201 patch ported by Jens Andersen <jens.andersen@gmail.com>

  Hammerhead is the first device I've ported this patch to which uses
  device tree binary instead of atags. It is also rather picky - its
  bootloader erases first 128MB of RAM on reboot, so following hacks had
  to be applied:
  * Copy dtb to location passed in r2 before jumping to kexecd' kernel,
    the kernel would just freeze when I left dtb above 128MB of RAM.
  * Copy kexecd' kernel to location in the first 128MB before jumping to it,
    the decompressor operates very slowly if the kernel is above the cached
    area, copying it lower and decompressing it afterwards is much faster.

  Same as my mako/flo patches, the guest kernel does not require any
  modifications, kexec-hardboot is equivalent to standard kexec.

  To support dtb, following commit was backported from the mainline:
    commit 4cabd1d9625c7d88acd143f4021fbef75394f154
    Author: Matthew Leach <matthew.leach@arm.com>
    Date:   Fri Sep 21 18:56:02 2012 +0100

      ARM: 7539/1: kexec: scan for dtb magic in segments

      This patch allows a dtb to be passed to a new kernel using the kexec
      mechinism.

      When loading segments from userspace, scan each segment's first four
      bytes for the dtb magic. If this is found set the kexec_boot_atags
      parameter to the relocate_kernel code to the phyical address of this
      segment.

Davide Pianca <kingbabasula@gmail.com>:
  Ported from https://gist.github.com/Tasssadar/7833796
  Adapted for bacon
Change KEXEC_HB_KERNEL_LOC

Reduces the boot speed on secondary ROM from 40 to 25 seconds
defconfig: delete unnecessary configs + enable kexec hardboot
defconfig: tyr configuration