From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8907 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Support for out-of-tree build Date: Fri, 20 Nov 2015 17:20:00 -0500 Message-ID: <20151120222000.GA3818@brightrain.aerifal.cx> References: <20151117220141.GD3818@brightrain.aerifal.cx> <20151117230606.GJ18372@port70.net> <20151117232711.GG3818@brightrain.aerifal.cx> <20151117234330.GH3818@brightrain.aerifal.cx> <20151118001955.GI3818@brightrain.aerifal.cx> <20151118214452.GQ3818@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1448058094 11923 80.91.229.3 (20 Nov 2015 22:21:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Nov 2015 22:21:34 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8920-gllmg-musl=m.gmane.org@lists.openwall.com Fri Nov 20 23:21:30 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Zzu3b-00040E-Mb for gllmg-musl@m.gmane.org; Fri, 20 Nov 2015 23:21:27 +0100 Original-Received: (qmail 5382 invoked by uid 550); 20 Nov 2015 22:20:14 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5338 invoked from network); 20 Nov 2015 22:20:12 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:8907 Archived-At: On Thu, Nov 19, 2015 at 12:22:09AM +0000, Petr Hosek wrote: > -SRCS = $(sort $(wildcard src/*/*.c arch/$(ARCH)/src/*.c)) > -OBJS = $(SRCS:.c=.o) > +BASE_SRCS = $(sort $(wildcard $(srcdir)/src/*/*.c $(srcdir)/arch/$(ARCH)/src/*.c)) > +BASE_OBJS = $(patsubst $(srcdir)/%.c,%.o,$(BASE_SRCS)) > +ARCH_SRCS = $(wildcard $(srcdir)/src/*/$(ARCH)/*.s $(srcdir)/src/*/$(ARCH)$(ASMSUBARCH)/*.sub) > +ARCH_OBJS = $(patsubst $(srcdir)/%.sub,%.o,$(patsubst $(srcdir)/%.s,%.o,$(ARCH_SRCS))) > +EXCLUDE_OBJS = $(patsubst $(srcdir)/%,%,$(subst /$(ARCH)$(ASMSUBARCH)/,/,$(subst /$(ARCH)/,/,$(patsubst $(srcdir)/%,%,$(ARCH_OBJS))))) > +OBJS = $(addprefix $(objdir)/, $(filter-out $(EXCLUDE_OBJS), $(BASE_OBJS)) $(ARCH_OBJS) $(SUB_OBJS)) I think this is failing to replicate the current behavior where a .sub file in src/*/$(ARCH)$(ASMSUBARCH) replaces the .s file in src/*/$(ARCH). In cases where both exist we'll end up with duplicate symbol errors linking libc.so and both present (with the wrong one likely getting used) in libc.a. This problem will of course disappear when we get rid of .sub files, but that doesn't help unless we remove .sub files first. I suppose all that's needed for now is to add more EXCLUDE_OBJS using the same input but with: $(subst /$(ARCH)$(ASMSUBARCH)/,/$(ARCH)/,... instead of: $(subst /$(ARCH)$(ASMSUBARCH)/,/,... Does this sound right? Rich