From 4849597ab2e0671389e2a261596edb1dc86e8bb5 Mon Sep 17 00:00:00 2001 From: John Marino Date: Sat, 4 Feb 2012 19:27:10 +0100 Subject: [PATCH] CCVER=gcc46: Separate LDFLAGS meant for gcc and ld The same LDFLAGS variable was being applied to gcc and ld. Apparently gcc 4.4 and below recognized and accepted the -m switch and passed it on to the linker, but gcc 4.6 wasn't handling it. A new variable COMPILER_LDFLAGS has been created alongside LDFLAGS. The former is meant to be passed to gcc and the latter is passed to ld. --- sys/boot/pc32/kgzldr/Makefile | 6 ++---- sys/boot/pc32/loader/Makefile | 9 +++------ sys/boot/pc32/loader_tftp/Makefile | 10 +++------- sys/boot/pc64/Makefile.inc | 1 + 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/sys/boot/pc32/kgzldr/Makefile b/sys/boot/pc32/kgzldr/Makefile index 5e7dd95401..ff6c9993a2 100644 --- a/sys/boot/pc32/kgzldr/Makefile +++ b/sys/boot/pc32/kgzldr/Makefile @@ -1,12 +1,10 @@ # $FreeBSD: src/sys/boot/i386/kgzldr/Makefile,v 1.16 2003/06/30 00:15:38 ru Exp $ -# $DragonFly: src/sys/boot/pc32/kgzldr/Makefile,v 1.3 2003/11/10 06:08:35 dillon Exp $ SRCS= start.s boot.c inflate.c lib.c crt.s sio.s OBJS= ${SRCS:N*.h:R:S/$/.o/g} -CFLAGS= -ffreestanding CFLAGS+=-Os CFLAGS+=-DKZIP -LDFLAGS=-nostdlib -static -Wl,-r +COMPILER_LDFLAGS=-nostdlib -static -Wl,-r .PATH: ${.CURDIR}/../../../kern CLEANFILES=kgzldr.o @@ -17,7 +15,7 @@ AFLAGS+=--defsym SIO_PRT=${BOOT_COMCONSOLE_PORT} all: kgzldr.o kgzldr.o: ${OBJS} - ${CC} ${LDFLAGS} -o ${.TARGET} ${OBJS} + ${CC} ${COMPILER_LDFLAGS} -o ${.TARGET} ${OBJS} realinstall: ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ diff --git a/sys/boot/pc32/loader/Makefile b/sys/boot/pc32/loader/Makefile index f401009369..dd6607406a 100644 --- a/sys/boot/pc32/loader/Makefile +++ b/sys/boot/pc32/loader/Makefile @@ -1,5 +1,4 @@ # $FreeBSD: src/sys/boot/i386/loader/Makefile,v 1.66 2003/06/26 03:51:57 peter Exp $ -# $DragonFly: src/sys/boot/pc32/loader/Makefile,v 1.11 2005/09/03 23:52:49 dillon Exp $ # PROG= loader @@ -19,7 +18,6 @@ ORG= 0x0 # architecture-specific loader code SRCS= main.c conf.c -CFLAGS+= -ffreestanding # Enable PXE TFTP or NFS support, not both. #CFLAGS+= -DLOADER_TFTP_SUPPORT CFLAGS+= -DLOADER_NFS_SUPPORT @@ -51,8 +49,8 @@ CFLAGS+= -I${.CURDIR}/../../.. -I. CLEANFILES+= vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help -CFLAGS+= -Wall -LDFLAGS= -nostdlib -static -Ttext ${ORG} +CFLAGS+= -Wall +COMPILER_LDFLAGS= -nostdlib -static -Ttext ${ORG} # i386 standalone support library LIBI386= ${.OBJDIR}/../libi386/libi386.a @@ -85,7 +83,6 @@ CFLAGS+= -elf # Debug me! #CFLAGS+= -g -#LDFLAGS+= -g vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} @@ -120,7 +117,7 @@ FILES+= ${.CURDIR}/dloader.rc .include ${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBDLOADER} vers.o - ${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \ + ${CC} ${COMPILER_LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \ ${LIBDLOADER} ${LIBI386} ${LIBSTAND} # If it's not there, don't consider it a target diff --git a/sys/boot/pc32/loader_tftp/Makefile b/sys/boot/pc32/loader_tftp/Makefile index 6406b24add..049611433b 100644 --- a/sys/boot/pc32/loader_tftp/Makefile +++ b/sys/boot/pc32/loader_tftp/Makefile @@ -1,7 +1,5 @@ # Works like the normal loader except the kernel, modules, and other loader # files are loaded via TFTP instead of NFS. -# -# $DragonFly: src/sys/boot/pc32/loader_tftp/Makefile,v 1.2 2005/09/04 12:20:46 swildner Exp $ PROG= loader_tftp STRIP= @@ -21,7 +19,6 @@ ORG= 0x0 # architecture-specific loader code SRCS= main.c conf.c -CFLAGS+= -ffreestanding CFLAGS+= -DLOADER_TFTP_SUPPORT #CFLAGS+= -DLOADER_NFS_SUPPORT @@ -52,8 +49,8 @@ CFLAGS+= -I${.CURDIR}/../../.. -I. CLEANFILES+= vers.c vers.o ${PROG}.list ${PROG}.bin ${PROG}.sym ${PROG}.help -CFLAGS+= -Wall -LDFLAGS= -nostdlib -static -Ttext ${ORG} +CFLAGS+= -Wall +COMPILER_LDFLAGS= -nostdlib -static -Ttext ${ORG} # i386 standalone support library LIBI386= ${.OBJDIR}/../libi386/libi386.a @@ -86,7 +83,6 @@ CFLAGS+= -elf # Debug me! #CFLAGS+= -g -#LDFLAGS+= -g vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} @@ -120,7 +116,7 @@ FILES+= ${.CURDIR}/../loader/dloader.rc .include ${PROG}.sym: ${OBJS} ${LIBI386} ${LIBSTAND} ${LIBDLOADER} vers.o - ${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \ + ${CC} ${COMPILER_LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \ ${LIBDLOADER} ${LIBI386} ${LIBSTAND} # If it's not there, don't consider it a target diff --git a/sys/boot/pc64/Makefile.inc b/sys/boot/pc64/Makefile.inc index 508dc0615e..53202c8898 100644 --- a/sys/boot/pc64/Makefile.inc +++ b/sys/boot/pc64/Makefile.inc @@ -5,6 +5,7 @@ __pc64__: CFLAGS+= -m32 LDFLAGS+= -m elf_i386 +COMPILER_LDFLAGS+= -Wl,-m,elf_i386 AFLAGS+= --32 .include "../pc32/Makefile.inc" -- 2.41.0