mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] Remove possibly unused lines from Makefile
@ 2017-12-07 15:55 Nicholas Wilson
  2017-12-15  4:31 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Wilson @ 2017-12-07 15:55 UTC (permalink / raw)
  To: musl

Hi,

There are a couple of lines I've had to hack out of the Makefile to get Wasm to build. In WebAssembly, we can't use crti.s/crtn.s, because the compiler doesn't support raw assembly chunks like that.

That should be OK, since there are default empty files in "crt/{crti,crtn}.c". Those empty files are currently unused, as all archs provide the assembly versions. For WebAssembly, I'm happy for those empty C files to be used.

There's some clever stuff at the top of the Makefile to construct BASE_SRCS and ARCH_SRCS, and it works fine for WebAssembly: we just compile the dummy .c files if the .s files aren't provided by the arch.

The problem is further down the Makefile, where an apparently unnecessary dependency is placed on the assembly files. I can't work out why these two lines are there, and they need to be removed in one way or another for the Wasm build to succeed. Getting rid of them doesn't seem to have any negative consequences for the standard x86 build.

Patch below.

Thanks,
Nick

============
diff --git a/Makefile b/Makefile
index d2e89979..308ddaae 100644
--- a/Makefile
+++ b/Makefile
@@ -113,10 +113,6 @@ obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.c
 
 obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC
 
-obj/crt/$(ARCH)/crti.o: $(srcdir)/crt/$(ARCH)/crti.s
-
-obj/crt/$(ARCH)/crtn.o: $(srcdir)/crt/$(ARCH)/crtn.s
-
 OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%))
 $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove possibly unused lines from Makefile
  2017-12-07 15:55 [PATCH] Remove possibly unused lines from Makefile Nicholas Wilson
@ 2017-12-15  4:31 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2017-12-15  4:31 UTC (permalink / raw)
  To: musl

On Thu, Dec 07, 2017 at 03:55:52PM +0000, Nicholas Wilson wrote:
> Hi,
> 
> There are a couple of lines I've had to hack out of the Makefile to
> get Wasm to build. In WebAssembly, we can't use crti.s/crtn.s,
> because the compiler doesn't support raw assembly chunks like that.
> 
> That should be OK, since there are default empty files in
> "crt/{crti,crtn}.c". Those empty files are currently unused, as all
> archs provide the assembly versions. For WebAssembly, I'm happy for
> those empty C files to be used.
> 
> There's some clever stuff at the top of the Makefile to construct
> BASE_SRCS and ARCH_SRCS, and it works fine for WebAssembly: we just
> compile the dummy .c files if the .s files aren't provided by the
> arch.
> 
> The problem is further down the Makefile, where an apparently
> unnecessary dependency is placed on the assembly files. I can't work
> out why these two lines are there, and they need to be removed in
> one way or another for the Wasm build to succeed. Getting rid of
> them doesn't seem to have any negative consequences for the standard
> x86 build.
> 
> Patch below.
> 
> Thanks,
> Nick
> 
> ============
> diff --git a/Makefile b/Makefile
> index d2e89979..308ddaae 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -113,10 +113,6 @@ obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.c
>  
>  obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC
>  
> -obj/crt/$(ARCH)/crti.o: $(srcdir)/crt/$(ARCH)/crti.s
> -
> -obj/crt/$(ARCH)/crtn.o: $(srcdir)/crt/$(ARCH)/crtn.s
> -
>  OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%))
>  $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3
>  

Looks good. I'm committing this with a message explaining the
historical reasons these lines appeared and why it makes sense to
remove them.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-15  4:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 15:55 [PATCH] Remove possibly unused lines from Makefile Nicholas Wilson
2017-12-15  4:31 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).