Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 20 Nov 2015 17:20:00 -0500
From: Rich Felker <>
Subject: Re: Support for out-of-tree build

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 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?


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.