Bug 9201 - grub-efi-native fails to build because of trampolines
Summary: grub-efi-native fails to build because of trampolines
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.1 M4
Assignee: Bill Randle
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-03-02 21:05 UTC by Martin Jansa
Modified: 2016-03-21 15:12 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Jansa 2016-03-02 21:05:08 UTC
There are +- 30 places where gcc 5.3 generates error like this:

../grub-2.00/util/grub-script-check.c:99:14: error: trampoline generated for nested function 'get_config_line' [-Werror=trampolines]
   grub_err_t get_config_line (char **line, int cont __attribute__ ((unused)))
              ^

and fails, adding -Wno-error=trampolines helps, but I'm not sure if it's right work around or why I'm (possibly) the only one seeing this issue.

OE @ ~/build/oe-core/tmp-glibc/work/x86_64-linux/grub-efi-native/2.00-r3/build $ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/5.3.0/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/5.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmpfs/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/5.3.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.3.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.3.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/5.3.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/5.3.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 5.3.0 p1.0, pie-0.6.5' --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --enable-lto --without-isl --enable-libsanitizer
Thread model: posix
gcc version 5.3.0 (Gentoo 5.3.0 p1.0, pie-0.6.5) 

Also there is unused 0001-Fix-build-with-glibc-2.20.patch file, which was removed from SRC_URI in:

commit a290429c8415042cb8c2f4258e76a3cc6815a172
Author: Khem Raj <raj.khem@gmail.com>
Date:   Tue Jan 12 23:43:13 2016 +0000

    grub: Backport fix for largefile detection/use
Comment 1 Ross Burton 2016-03-04 11:52:43 UTC
Khem, would you be able to have a look at this?  Whilst no major distro is shipping gcc 5.3 now, it looks like Ubuntu 16.04 will ship with gcc 5.3 at about the same time as we release 2.1.
Comment 2 Ross Burton 2016-03-08 20:52:30 UTC
Using Debian's gcc-5 package (gcc version 5.3.1 20160224 (Debian 5.3.1-10)) grub-efi-native builds fine with no warnings.  Martin, can you still replicate this?
Comment 3 Ross Burton 2016-03-08 20:55:14 UTC
(pretty sure this is the first time I've seen Debian testing be ahead of Gentoo in a compiler!)
Comment 4 Martin Jansa 2016-03-09 10:37:49 UTC
Yes still reproducible with latest oe-core:
http://errors.yoctoproject.org/Errors/Build/13790/

I'm using minimalist gentoo chroot, in worst case you can download it here:
http://git.shr-project.org/git/?p=shr-chroot.git;a=summary
Comment 5 Bill Randle 2016-03-16 22:42:16 UTC
Using Fedora 23's gcc (gcc version 5.3.1 20151207 (Red Hat 5.3.1-2)), I also can build qemux86_64, including grub-efi, from master with no errors. I'll do some digging into what's going on with Gentoo.
Comment 6 Khem Raj 2016-03-17 04:43:36 UTC
(In reply to comment #1)
> Khem, would you be able to have a look at this?  Whilst no major distro is
> shipping gcc 5.3 now, it looks like Ubuntu 16.04 will ship with gcc 5.3 at
> about the same time as we release 2.1.

gentoo enables -Wtrampolines by default, thats why you see it. Disabling the warning
for native builds is the right fix here.
Comment 7 Ross Burton 2016-03-17 13:02:16 UTC
As it's gentoo explicitly adding that flag should we WONTFIX this as a gentoo issue and tell gentoo users to BUILD_CFLAGS_append = " -Wno-error-trampolines", or add something that like globally?
Comment 8 Khem Raj 2016-03-17 16:11:18 UTC
(In reply to comment #7)
> As it's gentoo explicitly adding that flag should we WONTFIX this as a
> gentoo issue and tell gentoo users to BUILD_CFLAGS_append = "
> -Wno-error-trampolines", or add something that like globally?

We dont lose much by enabling this option in metadata. It is a harder sell
to change gentoo's defaults. I would suggest to add it to concerned recipe and only for native case. So its surgical.
Comment 9 Ross Burton 2016-03-17 16:29:56 UTC
Sounds good to me.  Bill, can you handle this please.
Comment 10 Bill Randle 2016-03-17 16:34:19 UTC
I've set up a copy of the reporter's build environment, so I can go through and find all the trampoline warnings in his build and update the appropriate native recipes.
Comment 11 Khem Raj 2016-03-17 16:43:38 UTC
is it lot of packages ? I thought it was just grub-efi. If its many, then I think, we should just suggest that gentoo user's set this option globally and leave it at that.
Comment 12 Bill Randle 2016-03-17 16:46:39 UTC
I was thinking there was another package also, but I don't see it now, so maybe it was just grub-efi. I will verify when I do a test build of shr.
Comment 13 Martin Jansa 2016-03-17 17:28:57 UTC
Only grub is failing like this, because of default -Werror.

I've sent the patch I'm using:
http://lists.openembedded.org/pipermail/openembedded-core/2016-March/119141.html

because IIRC just adding -Wno-error-trampolines wasn't enough to solve this.
Comment 14 Khem Raj 2016-03-17 17:57:35 UTC
(In reply to comment #13)
> Only grub is failing like this, because of default -Werror.
> 
> I've sent the patch I'm using:
> http://lists.openembedded.org/pipermail/openembedded-core/2016-March/119141.
> html
> 
> because IIRC just adding -Wno-error-trampolines wasn't enough to solve this.

did you try -Wno-error=trampolines
Comment 15 Martin Jansa 2016-03-17 18:09:11 UTC
According to git reflog I was testing:

+# bsdlabel.c:161:7: error: trampoline generated for nested function 'check_msdos' [-Werror=trampolines]
+CFLAGS_append_class-native = " -Wno-error=trampolines"
Comment 16 Bill Randle 2016-03-18 00:04:50 UTC
Using -Wno-error=trampolines solves the problem, in my testing. Patch submitted to the mailing list.
Comment 17 Ross Burton 2016-03-21 15:12:12 UTC
Merged in oe-core c2450e4fd01487aaf5bb37a4c70a5397650ba5f8.