From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 2 09:49:38 2012 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0DD671065672 for ; Mon, 2 Jul 2012 09:49:38 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id CAB2E8FC0A for ; Mon, 2 Jul 2012 09:49:37 +0000 (UTC) Received: by obbun3 with SMTP id un3so10328779obb.13 for ; Mon, 02 Jul 2012 02:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=dyoq6Kg29a4QD7VmC/o25V+eH9F5UAhCJ7Bzg7qN7CU=; b=srdHU36oXsnfOkvHyqpxx8kr+on7jA2/Mlx8qALF78FylkZKjW3ir6pAiAj5u35gh5 VZUD69lf2J32uanmAN36cxvZ6Up47GxGW2a8WK2JaCCZnwLaPjXU8D1zs2qFnAlaFIPG fsqykgdt79j9RlMJou4fmYtpP9/OaESH4SEWtkRuVy9jTpmE6b8VZnVQed35aCLHCu/w r3T/LEDvaa+ZIXh4Q0QTOGKJFt9kGlB7mLhYpkzupPxeD6aRdb+dcKDole+zh86fcR4h Zk9Z279do2B4a4PdZS2I43d5dn46bPsS/ohrvgzozTSWHGj23roH0EtQ8bCuE8YNAMPA tMTQ== MIME-Version: 1.0 Received: by 10.60.3.194 with SMTP id e2mr12850382oee.1.1341222577168; Mon, 02 Jul 2012 02:49:37 -0700 (PDT) Received: by 10.76.84.7 with HTTP; Mon, 2 Jul 2012 02:49:37 -0700 (PDT) In-Reply-To: <4FF16CA4.2040700@gentoo.org> References: <4FF16CA4.2040700@gentoo.org> Date: Mon, 2 Jul 2012 02:49:37 -0700 Message-ID: From: Garrett Cooper To: Richard Yao Content-Type: text/plain; charset=ISO-8859-1 Cc: "hackers@FreeBSD.org" Subject: Re: How does bootinfo64.c find read_eflags() and write_eflags() on amd64? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2012 09:49:38 -0000 On Mon, Jul 2, 2012 at 2:40 AM, Richard Yao wrote: > /usr/src/sys/boot/i386/libi386/bootinfo64.c uses read_eflags() and > write_eflags(), which live as inline functions in > /usr/src/sys/i386/include/cpufunc.h. > /usr/src/sys/boot/i386/libi386/bootinfo64.c also includes > /usr/include/machine/cpufunc.h, but that is > /usr/src/sys/amd64/include/cpufunc.h on amd64, which does not contain > either of them. > > I do not understand how FreeBSD's build system finds these. I am trying > to build /usr/src/sys/boot on Gentoo Linux, but Gentoo Linux does not > understand this either: > > # env CFLAGS="-march=core2 -mtune=core2 -O2 -pipe -O2 > -fno-strict-aliasing -D__FreeBSD__=9 -D__FBSDID\(x\)= -nostdinc > -I/var/tmp/portage/sys-boot/boot0-9.0/work/include_proper" > MACHINE_CPUARCH=amd64 MACHINE_ARCH=amd64 > MAKESYSPATH=/usr/share/mk/freebsd pmake > Warning: Object directory not changed from original > /var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader > cc -march=core2 -mtune=core2 -O2 -pipe -O2 -fno-strict-aliasing > -D__FreeBSD__=9 -D__FBSDID\(x\)= -nostdinc > -I/var/tmp/portage/sys-boot/boot0-9.0/work/include_proper > -DLOADER_NFS_SUPPORT -DBOOT_FORTH > -I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../../ficl > -I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../../ficl/i386 > -DLOADER_GZIP_SUPPORT -DLOADER_GPT_SUPPORT > -I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../../common > -I. -Wall > -I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/.. > -I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../btx/lib > -ffreestanding -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow > -mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -march=i386 -std=gnu99 > -static -Wl,-Ttext,0x0 -nostdlib -Wl,-m,elf_i386 -o loader.sym > /var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../btx/lib/crt0.o > main.o conf.o vers.o boot.o commands.o console.o devopen.o disk.o > interp.o interp_backslash.o interp_parse.o ls.o misc.o module.o panic.o > load_elf32.o load_elf32_obj.o reloc_elf32.o load_elf64.o > load_elf64_obj.o reloc_elf64.o bcache.o isapnp.o pnp.o interp_forth.o > /var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../../ficl/libficl.a > > /var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../libi386/libi386.a > /usr/lib/libstand.a > /var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../libi386/libi386.a(bootinfo64.o): > In function `bi_load64': > bootinfo64.c:(.text+0x45a): undefined reference to `read_eflags' > bootinfo64.c:(.text+0x469): undefined reference to `write_eflags' > bootinfo64.c:(.text+0x46e): undefined reference to `read_eflags' > collect2: ld returned 1 exit status > *** Error code 1 > > Stop. > pmake: stopped in > /var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader > > How does bootinfo64.c obtain these symbols on FreeBSD? Via patterns like the following sprinkled around Makefiles under sys/boot that link things to their "proper spots": ln -sf ${.CURDIR}/../../../${MACHINE_CPUARCH}/include machine Cheers, -Garrett