Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jul 2011 04:01:26 +0400
From:      Pan Tsu <inyaoo@gmail.com>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        freebsd-toolchain@freebsd.org
Subject:   Re: [clang] boot2 fails to build with DEBUG_FLAGS?
Message-ID:  <8639i3dtpl.fsf@gmail.com>
References:  <86zkm74srn.fsf@gmail.com> <20110530161905.GA91202@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Roman Divacky <rdivacky@freebsd.org> writes:

> I dont have the same environment (I am using trunk llvm/clang) but I cant
> reproduce it here...
>
> fwiw, with trunk llvm DEBUG_FLAGS dies in assembly stage because our as
> does not know .cfi_section

Why sys/boot even allows user CFLAGS influence if it's that fragile?

  $ __MAKE_CONF=/dev/null make all CC=clang DEBUG_FLAGS='-g -fno-omit-frame-pointer'
  ===> i386/boot2 (all)
  objcopy -S -O binary boot1.out boot1
  dd if=/dev/zero of=boot2.ldr bs=512 count=1
  1+0 records in
  1+0 records out
  512 bytes transferred in 0.000016 secs (32051995 bytes/sec)
  [...]
  ld -static -N --gc-sections -nostdlib -m elf_i386_fbsd -Ttext 0x2000 -o boot2.out /usr/obj/usr/src/sys/boot/i386/boot2/../btx/lib/crt0.o boot2.o sio.o
  objcopy -S -O binary boot2.out boot2.bin
  btxld -v -E 0x2000 -f bin -b /usr/obj/usr/src/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=15bd text=0 data=0 bss=0 entry=0
  output: fmt=bin size=1e4d text=200 data=1c4d org=0 entry=0
  -77 bytes available
  *** Error code 1

And those DEBUG_FLAGS are handy to globally make world and ports
trace-friendly (gdb/pmc/dtrace) without losing optimization. Luckily

  .if ${.CURDIR:N*sys/boot*}
  DEBUG_FLAGS ?= -g -fno-omit-frame-pointer
  .endif

seems to work. OTOH, clang breaks gptzfsboot here, i.e.

   ZFS: zfs_alloc()/zfs_free() mismatch



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8639i3dtpl.fsf>