Bug 156771 - FreeBSD/arm fails to build trampoline code with clang due to missing -ffreestanding
Summary: FreeBSD/arm fails to build trampoline code with clang due to missing -ffreest...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-02 17:40 UTC by Damjan Marion
Modified: 2011-06-15 20:22 UTC (History)
0 users

See Also:


Attachments
file.diff (767 bytes, patch)
2011-05-02 17:40 UTC, Damjan Marion
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Damjan Marion 2011-05-02 17:40:10 UTC
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).
Comment 1 dfilter service freebsd_committer freebsd_triage 2011-06-15 20:16:05 UTC
Author: cognet
Date: Wed Jun 15 19:15:50 2011
New Revision: 223116
URL: http://svn.freebsd.org/changeset/base/223116

Log:
  Add -ffreestanding to the command line, so taht inflate.c compiles and link
  properly with llvm.
  
  PR:		arm/156771
  Submitted by:	Damjan Marion <damjan dot marion at gmail DOT com>

Modified:
  head/sys/conf/Makefile.arm

Modified: head/sys/conf/Makefile.arm
==============================================================================
--- head/sys/conf/Makefile.arm	Wed Jun 15 19:09:58 2011	(r223115)
+++ head/sys/conf/Makefile.arm	Wed Jun 15 19:15:50 2011	(r223116)
@@ -108,7 +108,8 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$
 	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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 2 Olivier Houchard freebsd_committer freebsd_triage 2011-06-15 20:20:48 UTC
State Changed
From-To: open->closed

Committed, thanks !