Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 140986 - boot0 ldflags compilation error
Summary: boot0 ldflags compilation error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: AMD64 FreeBSD
: High normal (vote)
Assignee: Gentoo/BSD Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-18 17:55 UTC by Victor Roman Archidona
Modified: 2013-02-02 10:32 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
The patch drops LDFLAGS in ../Makefile.inc (boot0-6.1-amd64-ldflags.patch,339 bytes, patch)
2006-07-18 17:55 UTC, Victor Roman Archidona
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Roman Archidona 2006-07-18 17:55:16 UTC
When building boot0 it tries to use the following 'ld' command:

x86_64-gentoo-freebsd6.1-ld -static -N --gc-sections -nostdlib -m elf_i386_fbsd -e start -Ttext 0x7c00 -o boot1.out boot1.o

that throws the following error:

x86_64-gentoo-freebsd6.1-ld: cannot open linker script file ldscripts/elf_i386_fbsd.xbn: No such file or directory

The error is because '-nostdlib' is passed to ld as parameter, but is needed to not use a default stdlib.

Checking ../Makefile.inc we can see:

.if ${MACHINE_ARCH} == "amd64"
CFLAGS+=        -m32
LDFLAGS+=       -m elf_i386_fbsd
AFLAGS+=        --32
.endif

that is forcing "amd64" to use the "elf_i386_fbsd" BFD and it cannot by found. I think the BFD should be decided by LD at compile time. With the patch attached in the next message I removed it.

A "file" under some /boot files shows that is an x86 boot sector with the patch applied: 

root@localhost boot # pwd
/boot
root@localhost boot # for x in "boot boot0 boot0sio boot1 boot2"; do file ${x}; done
boot:     x86 boot sector; partition 4: ID=0xa5, active, starthead 0, startsector 0, 50000 sectors, code offset 0x3c, reserved sectors 0, Media descriptor 0x0, reserved 0x16, dos < 4.0 BootSector (0x1f)
boot0:    x86 boot sector
boot0sio: x86 boot sector
boot1:    x86 boot sector; partition 4: ID=0xa5, active, starthead 0, startsector 0, 50000 sectors, code offset 0x3c, reserved sectors 0, Media descriptor 0x0, reserved 0x16, dos < 4.0 BootSector (0x1f)
boot2:    data
root@localhost boot #

Related information:
root@localhost boot0 # gcc -v
Reading specs from /usr/lib/gcc/x86_64-gentoo-freebsd6.1/3.4.6/specs
Configured with: /var/tmp/portage/gcc-3.4.6-r1/work/gcc-3.4.6/configure --prefix=/usr --bindir=/usr/x86_64-gentoo-freebsd6.1/gcc-bin/3.4.6 --includedir=/usr/lib/gcc/x86_64-gentoo-freebsd6.1/3.4.6/include --datadir=/usr/share/gcc-data/x86_64-gentoo-freebsd6.1/3.4.6 --mandir=/usr/share/gcc-data/x86_64-gentoo-freebsd6.1/3.4.6/man --infodir=/usr/share/gcc-data/x86_64-gentoo-freebsd6.1/3.4.6/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-gentoo-freebsd6.1/3.4.6/include/g++-v3 --host=x86_64-gentoo-freebsd6.1 --build=x86_64-gentoo-freebsd6.1 --disable-altivec --disable-nls --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --enable-multilib --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit
Thread model: posix
gcc version 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)
root@localhost boot0 #

root@localhost boot0 # ld -nostdlib -V
GNU ld version 2.17
  Supported emulations:
   elf_x86_64_fbsd
   elf_i386_fbsd
   elf_x86_64
   elf_i386
root@localhost boot0 #


root@localhost boot # emerge --info
Portage 2.1 (!/usr/local/amd64-fbsd-portage/profiles/default-bsd/fbsd/6.1/amd64, gcc-3.4.6, freebsd-lib-6.1-r0, 6.1-RELEASE amd64)
=================================================================
System uname: 6.1-RELEASE amd64 amd64
Gentoo Base System version 20060420
ccache version 2.4 [enabled]
app-admin/eselect-compiler: [Not Present]
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r2
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.13-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  6.1
ACCEPT_KEYWORDS="amd64-fbsd ~amd64-fbsd"
AUTOCLEAN="yes"
CBUILD="x86_64-gentoo-freebsd6.1"
CFLAGS="-march=k8 -O2 -pipe"
CHOST="x86_64-gentoo-freebsd6.1"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=k8 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks metadata-transfer sfperms strict"
GENTOO_MIRRORS="http://linuv.uv.es/mirror/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/amd64-fbsd-portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64-fbsd X berkdb crypt cups gdbm gif ipv6 jpeg ncurses ogg oss pam perl png python readline ssl tcpd truetype usb xml xorg xv zlib elibc_FreeBSD kernel_FreeBSD userland_BSD"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Victor Roman Archidona 2006-07-18 17:55:53 UTC
Created attachment 92169 [details, diff]
The patch drops LDFLAGS in ../Makefile.inc
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-07-19 18:51:49 UTC
Victor this patch does not seem to apply cleanly, can you take a look for one that applies clean on boot0 ebuild?
Comment 3 Victor Roman Archidona 2006-07-20 02:00:58 UTC
The problem resides in "-m32" flag of GCC. For now in FreeBSD/Amd64 systems cannot be used due its early development stage so we need boot0-static (see #141135). 
Comment 4 Alexis Ballier gentoo-dev 2013-02-02 10:32:00 UTC
this has been fixed long ago afaik