Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fix for kern/51772 breaks linking multi-config kernels?



Dear Christos,

On 2017-01-04, Christos Zoulas wrote:
> In article <20170104195823.GD26839@HOME>,
> Yorick Hardy  <yorickhardy%gmail.com@localhost> wrote:
> >Dear Martin,
> >
> >On 2017-01-04, Martin Husemann wrote:
> >> Can't you just use swap${.TARGET}.c instead of the wildcard?
> >> 
> >> Martin
> >
> >I don't think so, because then we pickup more than one swap*.o
> >when linking (and redefinition of symbols).
> >
> >Or did I misunderstand? (I assumed you meant swap${.TARGET}.o).
> >
> >I think I have a working patch, but I think we can do better (i.e. less
> >assumptions about filenames):
> >
> >Index: sys/conf/Makefile.kern.inc
> >===================================================================
> >RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
> >retrieving revision 1.251
> >diff -u -r1.251 Makefile.kern.inc

[snip]

> I thought we wanted to match the M and N modifiers so we select and deselect
> the same files?

That was my thought too! But when multiple kernels are configured we get multiple
swap*.o files with duplicate symbols.

How about the following? This patch removes all the wildcards, removes the swap*.o
files for all configured kernels and includes the swap*.o file for the current target.
Did I miss anything?

-- 
Kind regards,

Yorick Hardy

Index: sys/conf/Makefile.kern.inc
===================================================================
RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
retrieving revision 1.252
diff -u -r1.252 Makefile.kern.inc
--- sys/conf/Makefile.kern.inc	4 Jan 2017 19:55:06 -0000	1.252
+++ sys/conf/Makefile.kern.inc	4 Jan 2017 20:26:50 -0000
@@ -203,6 +203,10 @@
 
 SYSTEM_LIB=	${MD_LIBS} ${SYSLIBCOMPAT} ${LIBKERN}
 SYSTEM_OBJ?=	${_MD_OBJS} ${OBJS} ${SYSTEM_LIB}
+REMOVE_SWAP=	[@]
+.for k in ${KERNELS}
+REMOVE_SWAP:=	${REMOVE_SWAP}:Nswap${k}.o
+.endfor
 SYSTEM_DEP+=	Makefile ${SYSTEM_OBJ:O}
 .if defined(CTFMERGE)
 SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
@@ -213,11 +217,11 @@
 SYSTEM_LD?=	${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}"; \
 		${_MKSHECHO}\
 		${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
-		'$${SYSTEM_OBJ:N*swap${.TARGET}.o}' '$${EXTRA_OBJ}' vers.o \
-		${OBJS:M*swap${.TARGET}.o}; \
+		'$${SYSTEM_OBJ:${REMOVE_SWAP}}' '$${EXTRA_OBJ}' vers.o \
+		${OBJS:Mswap${.TARGET}.o}; \
 		${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
-		${SYSTEM_OBJ:N*swap${.TARGET}.o} ${EXTRA_OBJ} vers.o \
-		${OBJS:M*swap${.TARGET}.o}
+		${SYSTEM_OBJ:${REMOVE_SWAP}} ${EXTRA_OBJ} vers.o \
+		${OBJS:Mswap${.TARGET}.o}
 
 TEXTADDR?=	${LOADADDRESS}			# backwards compatibility
 LINKTEXT?=	${TEXTADDR:C/.+/-Ttext &/}


Home | Main Index | Thread Index | Old Index