On Sat, Jan 31, 2015 at 01:10:02PM +0100, Michael Zimmermann wrote: > What I almost forgot is that you need the following patch to fix > compilation with O2/O3(it fixes warnings):
I can verify that this patch works, and makes it possible to compile with gcc 4.9 at -O3 (so is effectively a prerequisite for the added relocation handling patch I just sent). The only question I would have is whether this approach is considered OK, or whether we should try to figure out why gcc spots potential "used uninitialised" paths in the code? / Leif > From 54fe81d049c1ea24f8dc72eff16e88bf39291c7d Mon Sep 17 00:00:00 2001 > From: M1cha <sigmaepsilo...@gmail.com> > Date: Sat, 31 Jan 2015 13:08:43 +0100 > Subject: [PATCH 1/1] fix compilation with O2/O3 > > --- > grub-core/commands/verify.c | 2 +- > grub-core/fs/hfsplus.c | 8 ++++---- > grub-core/gnulib/regcomp.c | 2 +- > grub-core/normal/main.c | 2 +- > 4 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/grub-core/commands/verify.c b/grub-core/commands/verify.c > index 6569391..9620a3b 100644 > --- a/grub-core/commands/verify.c > +++ b/grub-core/commands/verify.c > @@ -454,7 +454,7 @@ grub_verify_signature_real (char *buf, grub_size_t size, > grub_err_t err; > grub_size_t i; > gcry_mpi_t mpis[10]; > - grub_uint8_t type; > + grub_uint8_t type = 0; > > err = read_packet_header (sig, &type, &len); > if (err) > diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c > index 8f07f85..f7a43f1 100644 > --- a/grub-core/fs/hfsplus.c > +++ b/grub-core/fs/hfsplus.c > @@ -786,8 +786,8 @@ grub_hfsplus_iterate_dir (grub_fshelp_node_t dir, > }; > > struct grub_hfsplus_key_internal intern; > - struct grub_hfsplus_btnode *node; > - grub_disk_addr_t ptr; > + struct grub_hfsplus_btnode *node = NULL; > + grub_disk_addr_t ptr = 0; > > { > struct grub_fshelp_node *fsnode; > @@ -970,8 +970,8 @@ grub_hfsplus_label (grub_device_t device, char **label) > struct grub_hfsplus_catkey *catkey; > int i, label_len; > struct grub_hfsplus_key_internal intern; > - struct grub_hfsplus_btnode *node; > - grub_disk_addr_t ptr; > + struct grub_hfsplus_btnode *node = NULL; > + grub_disk_addr_t ptr = 0; > > *label = 0; > > diff --git a/grub-core/gnulib/regcomp.c b/grub-core/gnulib/regcomp.c > index 596e0cf..1c36c7e 100644 > --- a/grub-core/gnulib/regcomp.c > +++ b/grub-core/gnulib/regcomp.c > @@ -3143,7 +3143,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t > *dfa, re_token_t *token, > > while (1) > { > - bracket_elem_t start_elem, end_elem; > + bracket_elem_t start_elem = {0}, end_elem = {0}; > unsigned char start_name_buf[BRACKET_NAME_BUF_SIZE]; > unsigned char end_name_buf[BRACKET_NAME_BUF_SIZE]; > reg_errcode_t ret; > diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c > index 623b93b..78a70a8 100644 > --- a/grub-core/normal/main.c > +++ b/grub-core/normal/main.c > @@ -445,7 +445,7 @@ grub_cmdline_run (int nested, int force_auth) > > while (1) > { > - char *line; > + char *line = NULL; > > if (grub_normal_exit_level) > break; > -- > 2.1.0 > > On Sat, Jan 31, 2015 at 1:01 PM, Michael Zimmermann > <sigmaepsilo...@gmail.com> wrote: > > I forgot the Linux distro: (it doesn't matter since I'm cross > > compiling) Ubuntu 14.10 > > > > On Sat, Jan 31, 2015 at 1:00 PM, Michael Zimmermann > > <sigmaepsilo...@gmail.com> wrote: > >> The configure line: > >> ./configure --host arm-linux-gnueabihf CFLAGS='-static-libgcc > >> -Wl,-static' TARGET_CFLAGS='-O3' > >> > >> My compiler is gcc-linaro-arm-linux-gnueabihf-4.9-2014.09 ( > >> http://releases.linaro.org/14.09/components/toolchain/binaries ) > >> > >> gcc -v : > >> Using built-in specs. > >> COLLECT_GCC=./prebuilts/gcc/linux-x86/arm/arm-linux-gnueabihf-4.9/bin/arm-linux-gnueabihf-gcc > >> COLLECT_LTO_WRAPPER=/media/Data/repositories/git/bigG/prebuilts/gcc/linux-x86/arm/arm-linux-gnueabihf-4.9/bin/../libexec/gcc/arm-linux-gnueabihf/4.9.2/lto-wrapper > >> Target: arm-linux-gnueabihf > >> Configured with: > >> /cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/gcc-linaro-4.9-2014.09/configure > >> --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu > >> --target=arm-linux-gnueabihf > >> --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install > >> --with-sysroot=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install/arm-linux-gnueabihf/libc > >> --enable-languages=c,c++,fortran --disable-multilib --enable-multiarch > >> --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 > >> --with-float=hard --with-pkgversion='crosstool-NG > >> linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09' > >> --with-bugurl=https://bugs.launchpad.net/gcc-linaro > >> --enable-__cxa_atexit --enable-libmudflap --enable-libgomp > >> --enable-libssp > >> --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static > >> --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static > >> --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static > >> --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static > >> --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static > >> --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static > >> --enable-threads=posix --disable-libstdcxx-pch > >> --enable-linker-build-id --enable-plugin --enable-gold > >> --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install/arm-linux-gnueabihf/libc > >> --enable-c99 --enable-long-long --with-mode=thumb --disable-multilib > >> --with-float=hard > >> Thread model: posix > >> gcc version 4.9.2 20140904 (prerelease) (crosstool-NG > >> linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) > >> > >> Michael > >> > >> On Sat, Jan 31, 2015 at 12:45 PM, Leif Lindholm > >> <leif.lindh...@linaro.org> wrote: > >>> On Sat, Jan 31, 2015 at 12:35:34PM +0100, Michael Zimmermann wrote: > >>>> when compiling grub with O2 or O3 on a ARM target mkimage fails with > >>>> "error: relocation4 X is not implemented yet" for > >>>> R_ARM_THM_MOVT_ABS and R_ARM_THM_MOVW_ABS_NC (thumb) > >>>> or R_ARM_MOVW_ABS and R_ARM_MOVW_ABS_NC (arm) > >>> > >>> To help me try to reproduce: > >>> What are your complete config options (how are you adding the -O2/O3)? > >>> What toolchain version (output of gcc -v)? > >>> And (for my own curiosity) which Linux distribution? > >>> > >>> / > >>> Leif > >>> > >>> _______________________________________________ > >>> Grub-devel mailing list > >>> Grub-devel@gnu.org > >>> https://lists.gnu.org/mailman/listinfo/grub-devel > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel