Summary: | sys-freebsd/boot0-9.0 fails to build with USE=zfs and either Clang or GCC 4.6 | ||
---|---|---|---|
Product: | Gentoo/Alt | Reporter: | Richard Yao (RETIRED) <ryao> |
Component: | FreeBSD | Assignee: | Gentoo/BSD Team <bsd+disabled> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | nigoro.dev |
Priority: | Normal | Keywords: | Bug, Goal |
Version: | unspecified | ||
Hardware: | All | ||
OS: | FreeBSD | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 363579, 417789, 426838, 427430, 462580 | ||
Attachments: |
sys-freebsd/boot0-9.0 build.log of failure
Fix a compilation error with LLVM/Clang 3.1 sample patch for boot0-9.0-ebuild Fix a compilation error with GCC 4.6 sample patch for boot0-9.1_rc3.ebuild files/boot0-9.1-gcc46.patch sample patch for boot0-9.1_rc3.ebuild sample patch for boot0-9.1_rc3.ebuild backport patch for boot0-9.1.ebuild |
Description
Richard Yao (RETIRED)
2012-03-27 02:15:21 UTC
Running `CC=gcc-4.5.3 emerge -1v sys-freebsd/boot0` will workaround this problem. Also no problem with gcc-4.5.3-r2 here. >=gcc-4.6.0 is still masked for testing. I don't take much look at this while it's masked. (In reply to comment #2) > Also no problem with gcc-4.5.3-r2 here. >=gcc-4.6.0 is still masked for > testing. I don't take much look at this while it's masked. It might be worthwhile to make a tracker bug for GCC 4.6.0 support. Anyway, I agree that fixing this is a low priority. *** Bug 417703 has been marked as a duplicate of this bug. *** Created attachment 313301 [details, diff] Fix a compilation error with LLVM/Clang 3.1 I am attaching the patch from bug #417703. It addresses a build failure caused by an invalid flag. It does not address the issue where the boot code is too large. *** Bug 419503 has been marked as a duplicate of this bug. *** Created attachment 315285 [details, diff]
sample patch for boot0-9.0-ebuild
Change to compile it using the clang or gcc-4.5.* .
for the compile to be successful with a clang, it is necessary to modify the following.
src_prepare() {
- sed -e '/-fomit-frame-pointer/d' -e '/-mno-align-long-strings/d' \
+ sed -e '/-mno-align-long-strings/d' \
-i "${S}"/i386/boot2/Makefile \
Created attachment 315343 [details, diff]
Fix a compilation error with GCC 4.6
I have attached a patch that pass '-Wl,-m,elf_i386_fbsd' to the compiler instead of '-m elf_i386_fbsd'. This prevents GCC 4.6 from throwing an error, but unfortunately, the binaries produced by GCC 4.6 are too big:
btxld -v -E 0x2000 -f bin -b /var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/boot2/../btx/btx/btx -l boot2.ldr -o boot2.ld -P 1 boot2.bin
kernel: ver=1.02 size=690 load=9000 entry=9010 map=16M pgctl=1:1
client: fmt=bin size=1759 text=0 data=0 bss=0 entry=0
output: fmt=bin size=1fe9 text=200 data=1de9 org=0 entry=0
-489 bytes available
(In reply to comment #8) > Created attachment 315343 [details, diff] [details, diff] > Fix a compilation error with GCC 4.6 > > I have attached a patch that pass '-Wl,-m,elf_i386_fbsd' to the compiler > instead of '-m elf_i386_fbsd'. This prevents GCC 4.6 from throwing an error, > but unfortunately, the binaries produced by GCC 4.6 are too big: > > btxld -v -E 0x2000 -f bin -b > /var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/boot2/../btx/btx/ > btx -l boot2.ldr -o boot2.ld -P 1 boot2.bin > kernel: ver=1.02 size=690 load=9000 entry=9010 map=16M pgctl=1:1 > client: fmt=bin size=1759 text=0 data=0 bss=0 entry=0 > output: fmt=bin size=1fe9 text=200 data=1de9 org=0 entry=0 > -489 bytes available We can follow upstream discussion here. http://lists.freebsd.org/pipermail/freebsd-current/2012-March/032345.html Some patch are available - Build boot2 separating for ufs1 and ufs2 http://people.freebsd.org/~jkim/boot2.diff - Boot2 shirinking (Seems to have bugs. Be careful) http://lists.freebsd.org/pipermail/freebsd-current/2012-March/032378.html Also there's a branch to support big boot block http://svnweb.freebsd.org/base/projects/bigbb/ We could try patching boot0 to let us disable ufs support entirely. Then we could have a USE flag that people could disable as a workaround. (In reply to comment #7) > Created attachment 315285 [details, diff] [details, diff] > sample patch for boot0-9.0-ebuild > > Change to compile it using the clang or gcc-4.5.* . > > for the compile to be successful with a clang, it is necessary to modify the > following. > > src_prepare() { > - sed -e '/-fomit-frame-pointer/d' -e '/-mno-align-long-strings/d' \ > + sed -e '/-mno-align-long-strings/d' \ > -i "${S}"/i386/boot2/Makefile \ This is correct, but the code generated by GCC 4.6 (and GCC 4.7) is still too large. It might be worthwhile to try implementing support for -mno-align-long-strings in our toolchain. The changes are isolated to a single file: https://github.com/freebsd/freebsd-head/blob/master/contrib/gcc/config/i386/i386.c Would anyone like to volunteer to forward port that to our toolchain? Created attachment 330476 [details, diff]
sample patch for boot0-9.1_rc3.ebuild
sample patch for compiling boot0 using gcc4.6.
Created attachment 330478 [details, diff]
files/boot0-9.1-gcc46.patch
Fixed an issue too big of boot2
Created attachment 330530 [details, diff] sample patch for boot0-9.1_rc3.ebuild This patch changes that can be compiled using gcc-4.6 and clang-3.1 Tested on amd64-fbsd 9.1_rc3 * gcc-4.5.4 * gcc-4.6.3 * gcc-4.7.2 * changed clang-3.1-r5 (see bug #427430) (In reply to comment #5) > Created attachment 313301 [details, diff] [details, diff] > Fix a compilation error with LLVM/Clang 3.1 not required in boot0-9.1_rc3. (In reply to comment #14) > Created attachment 330530 [details, diff] [details, diff] > sample patch for boot0-9.1_rc3.ebuild > > This patch changes that can be compiled using gcc-4.6 and clang-3.1 It would be possible to use gcc-{majour,minor}-version() from toolchain-funcs.eclass instead of -dumpversion. Created attachment 330604 [details, diff] sample patch for boot0-9.1_rc3.ebuild (In reply to comment #15) > (In reply to comment #14) > > Created attachment 330530 [details, diff] [details, diff] [details, diff] > > sample patch for boot0-9.1_rc3.ebuild > > > > This patch changes that can be compiled using gcc-4.6 and clang-3.1 > > It would be possible to use gcc-{majour,minor}-version() from > toolchain-funcs.eclass instead of -dumpversion. Thank you for your comment. I changed to conditional branches using gcc-{major,minor}-version. When >=gcc-4.6, add CFLAGS+= -fno-asynchronous-unwind-tables to i386/boot2/Makefile. If set -m32 in CFLAGS, given to linker automatically LDFLAGS="-m elf_i386_fbsd". so, add LDFLAGS="-m elf_i386_fbsd" in part minimum required for compile, remove the rest. If you think no problem to apply in all cases, please remove the conditional branches. Notes for Developers Checked CPP env when toolchain-funcs get the version of gcc. Please run the following in order to properly do a version check. Of course, it is not necessary if you have changed the version with gcc-config in advance. e.g.) CC=gcc-4.5.4 CPP=${CC} emerge sys-freebsd/boot0 CC=clang CPP=${CC} emerge sys-freebsd/boot0 FYI, toolchain-funcs.eclass <snip> _gcc_fullversion() { local ver="$1"; shift set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"` eval echo "$ver" } <snip> # gcc-4.6.3 -Os -Q --help=optimize | grep unwind-tables -fasynchronous-unwind-tables [enabled] -funwind-tables [disabled] # gcc -dumpspecs *link: %{!static:--eh-frame-hdr} %{m32:-m elf_i386_fbsd} %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} %{v:-V} %{assert*} %{R*} %{rpath*} %{defsym*} %{shared:-Bshareable %{h*} %{soname*}} %{!shared: %{!static: %{rdynamic:-export-dynamic} -dynamic-linker %(fbsd_dynamic_linker) } %{static:-Bstatic}} %{symbolic:-Bsymbolic} # clang -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__" 4 2 1 Created attachment 355870 [details, diff]
backport patch for boot0-9.1.ebuild
fixed in 9.2_rc1.
Backport to boot0-9.1.
(In reply to Yuta SATOH from comment #17) > Created attachment 355870 [details, diff] [details, diff] > backport patch for boot0-9.1.ebuild > > fixed in 9.2_rc1. > > Backport to boot0-9.1. + 27 Aug 2013; Alexis Ballier <aballier@gentoo.org> boot0-9.1.ebuild: + backport fix from 9.2 for bug #409815 by Yuta SATOH + |