Bug#706490: kfreebsd-9: building with clang-3.2

Steven Chamberlain steven at pyro.eu.org
Tue Apr 30 20:24:02 UTC 2013

Package: src:kfreebsd-9
Version: 9.0-10
Severity: wishlist
Tags: patch
User: debian-bsd at lists.debian.org
Usertags: kfreebsd
X-Debbugs-Cc: pkg-llvm-team at lists.alioth.debian.org


For future reference, attached is a patch that allows kfreebsd-9 (9.0)
to build with clang-3.2.  This might be useful as we currently have to
use gcc-4.6, that may not be available for long post-wheezy, and gcc-4.7
reportedly produced non-working kernel images.

I don't even know yet if the kernel image produced by clang-3.2 works,
but upstream are using clang as their default compiler now.

This patch addresses two build issues:

> ../../../amd64/acpica/acpi_wakecode.S:55:2: error: unexpected directive .code16

clang's built-in assembler does not support that feature yet, but we can
work around it with "-no-integrated-as" in CFLAGS (Clang-specific
option, not portable).

> clang -D__va_list=__builtin_va_list -isystem /usr/include/bsd -DLIBBSD_OVERLAY   -lbsd  -I. -I/home/steven/clang/kfreebsd-9-9.0/config -std=gnu99   -o config config.o main.o lang.o mkmakefile.o mkheaders.o mkoptions.o kernconf.o -ll -lsbuf
> main.o: In function `kernconfdump':
> main.c:(.text+0x95d): undefined reference to `___isoc99_sscanf'

This is very odd.  It didn't occur during the clang.debian.net test
build done on linux-amd64, so it may really be a kfreebsd headers bug.

It should be __isoc99_sscanf (two underscores only), but the extra
underscore is being prepended from the setting of __USER_LABEL_PREFIX__
(not sure where that is set...).

Adding "-D__USER_LABEL_PREFIX__= " to CFLAGS works around that issue.

Steven Chamberlain
steven at pyro.eu.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kfreebsd-9_clang-3.2_build.patch
Type: text/x-patch
Size: 2364 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20130430/0aa8e873/attachment.bin>

More information about the Pkg-llvm-team mailing list