From owner-freebsd-arm@FreeBSD.ORG Mon May 2 16:40:11 2011 Return-Path: Delivered-To: freebsd-arm@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A37D31065674 for ; Mon, 2 May 2011 16:40:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 155998FC15 for ; Mon, 2 May 2011 16:40:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p42GeALm070047 for ; Mon, 2 May 2011 16:40:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p42GeAvI070046; Mon, 2 May 2011 16:40:10 GMT (envelope-from gnats) Resent-Date: Mon, 2 May 2011 16:40:10 GMT Resent-Message-Id: <201105021640.p42GeAvI070046@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-arm@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Damjan Marion Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E22F01065673 for ; Mon, 2 May 2011 16:38:45 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id D11FE8FC14 for ; Mon, 2 May 2011 16:38:45 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p42GcjeE071074 for ; Mon, 2 May 2011 16:38:45 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p42Gcj7f071073; Mon, 2 May 2011 16:38:45 GMT (envelope-from nobody) Message-Id: <201105021638.p42Gcj7f071073@red.freebsd.org> Date: Mon, 2 May 2011 16:38:45 GMT From: Damjan Marion To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: arm/156771: FreeBSD/arm fails to build trampoline code with clang due to missing -ffreestanding X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2011 16:40:11 -0000 >Number: 156771 >Category: arm >Synopsis: FreeBSD/arm fails to build trampoline code with clang due to missing -ffreestanding >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-arm >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon May 02 16:40:10 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Damjan Marion >Release: -CURRENT >Organization: n/a >Environment: >Description: clang compiler produces optimized code which calls memset which is missing when kernel.trampoline is linked. inflate-tramp.o: In function `inflate_dynamic': /Volumes/data/src/freebsd/sys/kern/inflate.c:(.text+0x538): undefined reference to `memset' inflate-tramp.o: In function `huft_build': /Volumes/data/src/freebsd/sys/kern/inflate.c:(.text+0xb1c): undefined reference to `memset' This can be avoided by passing -ffreestanding (diff attached). >How-To-Repeat: >Fix: diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm index 756945d..d067fb3 100644 --- a/sys/conf/Makefile.arm +++ b/sys/conf/Makefile.arm @@ -108,7 +108,7 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c gzip -9 ${KERNEL_KO}.tmp eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \ echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h - ${CC} -O2 -DKZIP -I. -I$S -c $S/kern/inflate.c -o inflate-tramp.o + ${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/inflate.c -o inflate-tramp.o ${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \ -DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \ $S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp >Release-Note: >Audit-Trail: >Unformatted: