From owner-svn-src-all@FreeBSD.ORG Tue Nov 15 20:47:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74ACA106566C; Tue, 15 Nov 2011 20:47:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id B9E328FC24; Tue, 15 Nov 2011 20:47:28 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:a187:ded0:e7e9:99d4] (unknown [IPv6:2001:7b8:3a7:0:a187:ded0:e7e9:99d4]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 008335C59; Tue, 15 Nov 2011 21:47:26 +0100 (CET) Message-ID: <4EC2CFDD.7070206@FreeBSD.org> Date: Tue, 15 Nov 2011 21:47:25 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201111152015.pAFKFwqb015331@svn.freebsd.org> In-Reply-To: <201111152015.pAFKFwqb015331@svn.freebsd.org> X-Enigmail-Version: 1.3.3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r227538 - head/tools/build X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 20:47:29 -0000 On 2011-11-15 21:15, Dimitry Andric wrote: > Author: dim > Date: Tue Nov 15 20:15:58 2011 > New Revision: 227538 > URL: http://svn.freebsd.org/changeset/base/227538 > > Log: > LLVM uses atomic operations, which are not supported on i386 and GCC > emits calls for them, rather than expanding them inline. Older FreeBSD > versions compile for i386 by default and as such we end up with > unresolved symbols when we build LLVM's TableGen utility as a build > tool on them. Add the functions that GCC emits here, but don't bother > to make them atomic. Such is not needed. > > Submitted by: marcel > MFC after: 1 week Note, this commit is a workaround for people upgrading their i386 machine to head from an older version, specifically head before r198344. Before this revision, gcc defaulted to emitting code for real i386 CPU's, which lack support for gcc's atomic builtins. Since the LLVM code in head uses these, you would get link errors similar to: [...building world...] c++ -O2 -pipe -I/usr/src/usr.bin/clang/tblgen/../../../contrib/llvm/include -I/usr/src/usr.bin/clang/tblgen/../../../contrib/llvm/tools/clang/include -I/usr/src/usr.bin/clang/tblgen/../../../contrib/llvm/utils/TableGen -I. -I/usr/src/usr.bin/clang/tblgen/../../../contrib/llvm/../../lib/clang/include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DLLVM_HOSTTRIPLE=\"i386-unknown-freebsd9.0\" -I/usr/obj/usr/src/tmp/legacy/usr/include -static -L/usr/obj/usr/src/tmp/legacy/usr/lib -o tblgen ARMDecoderEmitter.o AsmMatcherEmitter.o AsmWriterEmitter.o AsmWriterInst.o CallingConvEmitter.o CodeEmitterGen.o CodeGenDAGPatterns.o CodeGenInstruction.o CodeGenRegisters.o CodeGenTarget.o DAGISelEmitter.o DAGISelMatcher.o DAGISelMatcherEmitter.o DAGISelMatcherGen.o DAGISelMatcherOpt.o DisassemblerEmitter.o EDEmitter.o FastISelEmitter.o FixedLenDecoderEmitter.o InstrEnumEmitter.o InstrInfoEmitter.o IntrinsicEmitter.o PseudoLoweringEmitter.o RegisterInfoEmitt er.o SetTheory.o StringMatcher.o SubtargetEmitter.o TGValueTypes.o TableGen.o X86DisassemblerTables.o X86RecognizableInstr.o /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmtablegen/libllvmtablegen.a /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmsupport/libllvmsupport.a -legacy /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmsupport/libllvmsupport.a(Atomic.o)(.text+0x25): In function `llvm::sys::AtomicIncrement(unsigned int volatile*)': : undefined reference to `__sync_add_and_fetch_4' /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmsupport/libllvmsupport.a(Atomic.o)(.text+0x45): In function `llvm::sys::AtomicDecrement(unsigned int volatile*)': : undefined reference to `__sync_sub_and_fetch_4' /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmsupport/libllvmsupport.a(Atomic.o)(.text+0x5): In function `llvm::sys::AtomicAdd(unsigned int volatile*, unsigned int)': : undefined reference to `__sync_add_and_fetch_4' /usr/obj/usr/src/tmp/usr/src/usr.bin/clang/tblgen/../../../lib/clang/libllvmsupport/libllvmsupport.a(Atomic.o)(.text+0x61): In function `llvm::sys::CompareAndSwap(unsigned int volatile*, unsigned int, unsigned int)': : undefined reference to `__sync_val_compare_and_swap_4' *** Error code 1 Because it is not possible to reliably detect support for these atomic builtins at compile time, Marcel provided these placeholder functions to help the build complete successfully. Note all the final executables will use 'real' atomic operations. That is, unless you compile with CPUTYPE?=i386, and I wish you the best of luck in that case, you'll need it. :)