Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC

Bug 427430

Summary: When using latest clang-3.1-r5, sys-freebsd/boot0-9.0/9.1_beta1 will fail to compile
Product: Gentoo/Alt Reporter: Yuta SATOH <nigoro.dev>
Component: FreeBSDAssignee: Gentoo/BSD Team <bsd+disabled>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: FreeBSD   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 409815    
Bug Blocks:    
Attachments: successfully compiled, patch for clang-3.1-r5.ebuild

Description Yuta SATOH 2012-07-21 04:42:58 UTC
When using the later versions of clang-3.1-r4, boot0 will fail to compile.

# emerge -p sys-devel/clang sys-devel/llvm 
[ebuild   R    ] sys-devel/llvm-3.1-r2
[ebuild   R    ] sys-devel/clang-3.1-r5

===> i386 (all)
===> i386/mbr (all)
Warning: Object directory not changed from original /var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/mbr
as  --defsym FLAGS=0x80 --32 -o mbr.o mbr.s
clang -O2 -pipe -fno-strict-aliasing  -ffreestanding -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -march=i386 -std=gnu99 -Qunused-arguments   -e start -Ttext 0x600 -Wl,-N,-S,--oformat,binary -nostdlib -m elf_i386_fbsd -o mbr mbr.o
/usr/bin/x86_64-gentoo-freebsd9.0-ld: cannot find 0x600: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
1 error
*** Error code 2
1 error
*** Error code 2
1 error

# emerge -p sys-devel/clang sys-devel/llvm
[ebuild   R    ] sys-devel/llvm-3.1-r2
[ebuild   R    ] sys-devel/clang-3.1-r2

===> i386/boot2 (all)
Warning: Object directory not changed from original /var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/boot2
dd if=/dev/zero of=boot2.ldr bs=512 count=1
ln -sf /var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/boot2/../../../i386/include machine
clang -Os  -fno-guess-branch-probability  -fno-unit-at-a-time  -mrtd  -mregparm=3  -DUSE_XREAD  -DUFS1_AND_UFS2  -DFLAGS=0x80  -DSIOPRT=0x3f8  -DSIOFMT=0x3  -DSIOSPD=9600  -I/var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/boot2/../../common  -I/var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/boot2/../btx/lib -I.  -Wall -Waggregate-return -Wbad-function-cast -Wcast-align  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs  -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings  -Winline --param max-inline-insns-single=100 -mllvm -stack-alignment=8 -mllvm -inline-threshold=3  -mllvm -enable-load-pre=false -no-integrated-as -ffreestanding -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -march=i386 -std=gnu99    -m32 -c boot1.S
clang -Os  -fno-guess-branch-probability  -fno-unit-at-a-time  -mrtd  -mregparm=3  -DUSE_XREAD  -DUFS1_AND_UFS2  -DFLAGS=0x80  -DSIOPRT=0x3f8  -DSIOFMT=0x3  -DSIOSPD=9600  -I/var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/boot2/../../common  -I/var/tmp/portage/sys-freebsd/boot0-9.0/work/sys/boot/i386/boot2/../btx/lib -I.  -Wall -Waggregate-return -Wbad-function-cast -Wcast-align  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs  -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings  -Winline --param max-inline-insns-single=100 -mllvm -stack-alignment=8 -mllvm -inline-threshold=3  -mllvm -enable-load-pre=false  -ffreestanding -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -march=i386 -std=gnu99    -m32 -c sio.S
clang: warning: the clang compiler does not support '-fno-unit-at-a-time'
clang: warning: argument unused during compilation: '-fno-guess-branch-probability'
clang: warning: argument unused during compilation: '--param max-inline-insns-single=100'
clang: warning: argument unused during compilation: '-mpreferred-stack-boundary=2'
clang: warning: the clang compiler does not support '-fno-unit-at-a-time'
clang: warning: argument unused during compilation: '-fno-guess-branch-probability'
clang: warning: argument unused during compilation: '--param max-inline-insns-single=100'
clang: warning: argument unused during compilation: '-mpreferred-stack-boundary=2'
1+0 records in
1+0 records out
512 bytes transferred in 0.000046 secs (11126858 bytes/sec)
clang (LLVM option parsing): Unknown command line argument '-stack-alignment=8'.  Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-ssc-dce-limit=8'?
clang (LLVM option parsing): Unknown command line argument '-stack-alignment=8'.  Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-ssc-dce-limit=8'?
Comment 1 Yuta SATOH 2012-07-21 04:45:19 UTC
boot2 is known issue.
Comment 2 Yuta SATOH 2012-11-25 11:39:35 UTC
Created attachment 330528 [details, diff]
successfully compiled, patch for clang-3.1-r5.ebuild

Compiled successfully by reverting to gentoo-runtime-gcc-detection.patch from gentoo-runtime-gcc-detection-v3.patch.
new -v3 patch may have a problem on FreeBSD...
Comment 3 Yuta SATOH 2013-05-25 18:35:52 UTC
Attention point is the argument to the linker.

-L/usr/lib32 -L is set in the case of clang-3.1-gentoo-runtime-gcc-detection-v3.patch.
Other hand, -L/usr/lib32 -L/usr/lib/gcc/x86_64-gentoo-freebsd9.0/4.6.3 is set in the case of clang-3.1-gentoo-runtime-gcc-detection.patch.


# emerge -pv clang

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] sys-devel/clang-3.2  USE="static-analyzer -debug -multitarget -python {-test}" PYTHON_TARGETS="python2_7 (-pypy1_9) (-pypy2_0) (-python2_6)" 0 kB

clang-3.2, applied clang-3.1-gentoo-runtime-gcc-detection-v3.patch )
FYI, http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch?revision=1.1

# cd /var/tmp/portage/sys-freebsd/boot0-9.9999/work/sys/boot/i386/mbr
# CC=clang make
Warning: Object directory not changed from original /var/tmp/portage/sys-freebsd/boot0-9.9999/work/sys/boot/i386/mbr
as  --defsym FLAGS=0x80 --32 -o mbr.o mbr.s
clang -O2 -pipe  -march=i386 -ffreestanding -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -std=gnu99 -Qunused-arguments   -e start -Ttext 0x600 -Wl,-N,-S,--oformat,binary -nostdlib -o mbr mbr.o
/usr/bin/x86_64-gentoo-freebsd9.0-ld: cannot find 0x600: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** [mbr] Error code 1

Stop in /var/tmp/portage/sys-freebsd/boot0-9.9999/work/sys/boot/i386/mbr.


# clang -O2 -pipe  -march=i386 -ffreestanding -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -std=gnu99 -Qunused-arguments   -e start -Ttext 0x600 -Wl,-N,-S,--oformat,binary -nostdlib -v -o mbr mbr.o
clang version 3.2 (tags/RELEASE_32/final)
Target: i386-gentoo-freebsd9.0
Thread model: posix
 "/usr/bin/x86_64-gentoo-freebsd9.0-ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -m elf_i386_fbsd -o mbr -L/usr/lib32 -L -Ttext 0x600 -e start -N -S --oformat binary mbr.o
/usr/bin/x86_64-gentoo-freebsd9.0-ld: cannot find 0x600: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)


clang-3.2, applied clang-3.1-gentoo-runtime-gcc-detection.patch )
FYI, http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection.patch?revision=1.1

# cd /var/tmp/portage/sys-freebsd/boot0-9.9999/work/sys/boot/i386/mbr
# CC=clang make
Warning: Object directory not changed from original /var/tmp/portage/sys-freebsd/boot0-9.9999/work/sys/boot/i386/mbr
as  --defsym FLAGS=0x80 --32 -o mbr.o mbr.s
clang -O2 -pipe  -march=i386 -ffreestanding -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -std=gnu99 -Qunused-arguments   -e start -Ttext 0x600 -Wl,-N,-S,--oformat,binary -nostdlib -o mbr mbr.o

# clang -O2 -pipe  -march=i386 -ffreestanding -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -std=gnu99 -Qunused-arguments   -e start -Ttext 0x600 -Wl,-N,-S,--oformat,binary -nostdlib -v -o mbr mbr.o
clang version 3.2 (tags/RELEASE_32/final)
Target: i386-gentoo-freebsd9.0
Thread model: posix
 "/usr/bin/x86_64-gentoo-freebsd9.0-ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -m elf_i386_fbsd -o mbr -L/usr/lib32 -L/usr/lib/gcc/x86_64-gentoo-freebsd9.0/4.6.3 -Ttext 0x600 -e start -N -S --oformat binary mbr.o
Comment 4 Yuta SATOH 2013-06-21 12:51:17 UTC
I was confirmed to be buildable using clang-3.3.