diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc index 24f2077..bff50a8 100644 --- a/sys/boot/i386/Makefile.inc +++ b/sys/boot/i386/Makefile.inc @@ -3,6 +3,7 @@ # $FreeBSD: release/9.0.0/sys/boot/i386/Makefile.inc 224131 2011-07-17 13:50:21Z dim $ BINDIR?= /boot +CC_AS_LD?= no LOADER_ADDRESS?=0x200000 CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ @@ -12,7 +13,11 @@ LDFLAGS+= -nostdlib .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -m32 -march=i386 ACFLAGS+= -m32 +.if ${CC_AS_LD} == "yes" +LDFLAGS+= -Wl,-m,elf_i386_fbsd +.else LDFLAGS+= -m elf_i386_fbsd +.endif AFLAGS+= --32 .endif diff --git a/sys/boot/i386/boot0/Makefile b/sys/boot/i386/boot0/Makefile index 7378e6f..2082679 100644 --- a/sys/boot/i386/boot0/Makefile +++ b/sys/boot/i386/boot0/Makefile @@ -5,6 +5,7 @@ STRIP= BINMODE=${NOBINMODE} NO_MAN= SRCS= ${PROG}.S +CC_AS_LD=yes # Additional options that you can specify with make OPTS="..." # (these only apply to boot0.S) diff --git a/sys/boot/i386/btx/btx/Makefile b/sys/boot/i386/btx/btx/Makefile index 9a93383..cb71837 100644 --- a/sys/boot/i386/btx/btx/Makefile +++ b/sys/boot/i386/btx/btx/Makefile @@ -4,6 +4,7 @@ PROG= btx INTERNALPROG= NO_MAN= SRCS= btx.S +CC_AS_LD=yes .if defined(BOOT_BTX_NOHANG) BOOT_BTX_FLAGS=0x1 diff --git a/sys/boot/i386/btx/btxldr/Makefile b/sys/boot/i386/btx/btxldr/Makefile index 0d30fc5..f740ff2 100644 --- a/sys/boot/i386/btx/btxldr/Makefile +++ b/sys/boot/i386/btx/btxldr/Makefile @@ -4,6 +4,7 @@ PROG= btxldr INTERNALPROG= NO_MAN= SRCS= btxldr.S +CC_AS_LD=yes CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} diff --git a/sys/boot/i386/btx/lib/Makefile b/sys/boot/i386/btx/lib/Makefile index b24eb83..a6dcef8 100644 --- a/sys/boot/i386/btx/lib/Makefile +++ b/sys/boot/i386/btx/lib/Makefile @@ -5,5 +5,6 @@ INTERNALPROG= NO_MAN= SRCS= btxcsu.s btxsys.s btxv86.s LDFLAGS=-Wl,-r +CC_AS_LD=yes .include diff --git a/sys/boot/i386/cdboot/Makefile b/sys/boot/i386/cdboot/Makefile index a6e60f6..d158830 100644 --- a/sys/boot/i386/cdboot/Makefile +++ b/sys/boot/i386/cdboot/Makefile @@ -5,6 +5,7 @@ STRIP= BINMODE=${NOBINMODE} NO_MAN= SRCS= ${PROG}.s +CC_AS_LD=yes ORG= 0x7c00 diff --git a/sys/boot/i386/mbr/Makefile b/sys/boot/i386/mbr/Makefile index d6dbdf5..1db50b1 100644 --- a/sys/boot/i386/mbr/Makefile +++ b/sys/boot/i386/mbr/Makefile @@ -5,6 +5,7 @@ STRIP= BINMODE=${NOBINMODE} NO_MAN= SRCS= ${PROG}.s +CC_AS_LD=yes # MBR flags: 0x80 -- try packet interface (also known as EDD or LBA) BOOT_MBR_FLAGS?= 0x80 diff --git a/sys/boot/i386/pmbr/Makefile b/sys/boot/i386/pmbr/Makefile index 1fbecf4..14ba1ee 100644 --- a/sys/boot/i386/pmbr/Makefile +++ b/sys/boot/i386/pmbr/Makefile @@ -5,6 +5,7 @@ STRIP= BINMODE=${NOBINMODE} NO_MAN= SRCS= ${PROG}.s +CC_AS_LD=yes ORG= 0x600 diff --git a/sys/boot/i386/pxeldr/Makefile b/sys/boot/i386/pxeldr/Makefile index 625d838..5d9324c 100644 --- a/sys/boot/i386/pxeldr/Makefile +++ b/sys/boot/i386/pxeldr/Makefile @@ -9,6 +9,7 @@ FILES= ${BOOT} MAN= ${BOOT}.8 SRCS= ${LDR}.S CLEANFILES= ${BOOT} +CC_AS_LD=yes BOOT= pxeboot LDR= pxeldr diff --git a/sys/boot/pc98/btx/btx/Makefile b/sys/boot/pc98/btx/btx/Makefile index 2dff189..1fa1d22 100644 --- a/sys/boot/pc98/btx/btx/Makefile +++ b/sys/boot/pc98/btx/btx/Makefile @@ -4,6 +4,7 @@ PROG= btx INTERNALPROG= NO_MAN= SRCS= btx.S +CC_AS_LD=yes .if defined(BOOT_BTX_NOHANG) BOOT_BTX_FLAGS=0x1 diff --git a/sys/boot/pc98/btx/btxldr/Makefile b/sys/boot/pc98/btx/btxldr/Makefile index 54c0e10..7067559 100644 --- a/sys/boot/pc98/btx/btxldr/Makefile +++ b/sys/boot/pc98/btx/btxldr/Makefile @@ -4,6 +4,7 @@ PROG= btxldr INTERNALPROG= NO_MAN= SRCS= btxldr.S +CC_AS_LD=yes CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} diff --git a/sys/boot/pc98/cdboot/Makefile b/sys/boot/pc98/cdboot/Makefile index 2f20cdc..9d017a3 100644 --- a/sys/boot/pc98/cdboot/Makefile +++ b/sys/boot/pc98/cdboot/Makefile @@ -5,6 +5,7 @@ STRIP= BINMODE=${NOBINMODE} NO_MAN= SRCS= ${PROG}.s +CC_AS_LD=yes ORG= 0x0000