Message ID | 20230116175757.71059-8-mhartmay@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Some cleanup patches | expand |
On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > Use the C pre-processor for the linker script generation. For example, > this enables us the use of constants in the "linker scripts" `*.lds.S`. please explain that the original .lds scripts are being renamed to .lds.S, and that the .lds are now generated. > > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > --- > .gitignore | 1 + > s390x/Makefile | 6 ++++-- > s390x/{flat.lds => flat.lds.S} | 0 > s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 > s390x/snippets/c/{flat.lds => flat.lds.S} | 0 > 5 files changed, 5 insertions(+), 2 deletions(-) > rename s390x/{flat.lds => flat.lds.S} (100%) > rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) > rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%) > > diff --git a/.gitignore b/.gitignore > index 601822d67325..29f352c5ceb6 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -31,3 +31,4 @@ cscope.* > /s390x/comm.key > /s390x/snippets/*/*.hdr > /s390x/snippets/*/*.*obj > +/s390x/**/*.lds why ** ? > diff --git a/s390x/Makefile b/s390x/Makefile > index 31f6db11213d..45493160cdf8 100644 > --- a/s390x/Makefile > +++ b/s390x/Makefile > @@ -76,7 +76,7 @@ CFLAGS += -fno-delete-null-pointer-checks > LDFLAGS += -nostdlib -Wl,--build-id=none > > # We want to keep intermediate files > -.PRECIOUS: %.o > +.PRECIOUS: %.o %.lds > > asm-offsets = lib/$(ARCH)/asm-offsets.h > include $(SRCDIR)/scripts/asm-offsets.mak > @@ -159,6 +159,8 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDI > %.hdr.obj: %.hdr > $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ > > +%.lds: %.lds.S > + $(CPP) $(autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< > > .SECONDEXPANSION: > %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o > @@ -211,7 +213,7 @@ $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets) > > > arch_clean: asm_offsets_clean > - $(RM) $(TEST_DIR)/*.{o,elf,bin} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) > + $(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) > > generated-files = $(asm-offsets) > $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files) > diff --git a/s390x/flat.lds b/s390x/flat.lds.S > similarity index 100% > rename from s390x/flat.lds > rename to s390x/flat.lds.S > diff --git a/s390x/snippets/asm/flat.lds b/s390x/snippets/asm/flat.lds.S > similarity index 100% > rename from s390x/snippets/asm/flat.lds > rename to s390x/snippets/asm/flat.lds.S > diff --git a/s390x/snippets/c/flat.lds b/s390x/snippets/c/flat.lds.S > similarity index 100% > rename from s390x/snippets/c/flat.lds > rename to s390x/snippets/c/flat.lds.S
Claudio Imbrenda <imbrenda@linux.ibm.com> writes: > On Mon, 16 Jan 2023 18:57:55 +0100 > Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > >> Use the C pre-processor for the linker script generation. For example, >> this enables us the use of constants in the "linker scripts" `*.lds.S`. > > please explain that the original .lds scripts are being renamed to > .lds.S, and that the .lds are now generated. Okay. > >> >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> >> --- >> .gitignore | 1 + >> s390x/Makefile | 6 ++++-- >> s390x/{flat.lds => flat.lds.S} | 0 >> s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 >> s390x/snippets/c/{flat.lds => flat.lds.S} | 0 >> 5 files changed, 5 insertions(+), 2 deletions(-) >> rename s390x/{flat.lds => flat.lds.S} (100%) >> rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) >> rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%) >> >> diff --git a/.gitignore b/.gitignore >> index 601822d67325..29f352c5ceb6 100644 >> --- a/.gitignore >> +++ b/.gitignore >> @@ -31,3 +31,4 @@ cscope.* >> /s390x/comm.key >> /s390x/snippets/*/*.hdr >> /s390x/snippets/*/*.*obj >> +/s390x/**/*.lds > > why ** ? Because all of our linker scripts are generated now: s390x/snippets/(c|asm)/*.lds and s390x/*.lds […snip]
On Tue, 17 Jan 2023 10:43:01 +0100 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > Claudio Imbrenda <imbrenda@linux.ibm.com> writes: > > > On Mon, 16 Jan 2023 18:57:55 +0100 > > Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > > > >> Use the C pre-processor for the linker script generation. For example, > >> this enables us the use of constants in the "linker scripts" `*.lds.S`. > > > > please explain that the original .lds scripts are being renamed to > > .lds.S, and that the .lds are now generated. > > Okay. > > > > >> > >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > >> --- > >> .gitignore | 1 + > >> s390x/Makefile | 6 ++++-- > >> s390x/{flat.lds => flat.lds.S} | 0 > >> s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 > >> s390x/snippets/c/{flat.lds => flat.lds.S} | 0 > >> 5 files changed, 5 insertions(+), 2 deletions(-) > >> rename s390x/{flat.lds => flat.lds.S} (100%) > >> rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) > >> rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%) > >> > >> diff --git a/.gitignore b/.gitignore > >> index 601822d67325..29f352c5ceb6 100644 > >> --- a/.gitignore > >> +++ b/.gitignore > >> @@ -31,3 +31,4 @@ cscope.* > >> /s390x/comm.key > >> /s390x/snippets/*/*.hdr > >> /s390x/snippets/*/*.*obj > >> +/s390x/**/*.lds > > > > why ** ? > > Because all of our linker scripts are generated now: > > s390x/snippets/(c|asm)/*.lds > > and > > s390x/*.lds > > […snip] > I still don't understand why ** instead of just * ?
Claudio Imbrenda <imbrenda@linux.ibm.com> writes: > On Tue, 17 Jan 2023 10:43:01 +0100 > Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > >> Claudio Imbrenda <imbrenda@linux.ibm.com> writes: >> >> > On Mon, 16 Jan 2023 18:57:55 +0100 >> > Marc Hartmayer <mhartmay@linux.ibm.com> wrote: >> > >> >> Use the C pre-processor for the linker script generation. For example, >> >> this enables us the use of constants in the "linker scripts" `*.lds.S`. >> > >> > please explain that the original .lds scripts are being renamed to >> > .lds.S, and that the .lds are now generated. >> >> Okay. >> >> > >> >> >> >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> >> >> --- >> >> .gitignore | 1 + >> >> s390x/Makefile | 6 ++++-- >> >> s390x/{flat.lds => flat.lds.S} | 0 >> >> s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 >> >> s390x/snippets/c/{flat.lds => flat.lds.S} | 0 >> >> 5 files changed, 5 insertions(+), 2 deletions(-) >> >> rename s390x/{flat.lds => flat.lds.S} (100%) >> >> rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) >> >> rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%) >> >> >> >> diff --git a/.gitignore b/.gitignore >> >> index 601822d67325..29f352c5ceb6 100644 >> >> --- a/.gitignore >> >> +++ b/.gitignore >> >> @@ -31,3 +31,4 @@ cscope.* >> >> /s390x/comm.key >> >> /s390x/snippets/*/*.hdr >> >> /s390x/snippets/*/*.*obj >> >> +/s390x/**/*.lds >> > >> > why ** ? >> >> Because all of our linker scripts are generated now: >> >> s390x/snippets/(c|asm)/*.lds >> >> and >> >> s390x/*.lds >> >> […snip] >> > > I still don't understand why ** instead of just * ? “A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.” [1] [1] https://git-scm.com/docs/gitignore
On Tue, 17 Jan 2023 10:43:01 +0100 Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > Claudio Imbrenda <imbrenda@linux.ibm.com> writes: > > > On Mon, 16 Jan 2023 18:57:55 +0100 > > Marc Hartmayer <mhartmay@linux.ibm.com> wrote: > > > >> Use the C pre-processor for the linker script generation. For example, > >> this enables us the use of constants in the "linker scripts" `*.lds.S`. > > > > please explain that the original .lds scripts are being renamed to > > .lds.S, and that the .lds are now generated. > > Okay. > > > > >> > >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> > >> --- > >> .gitignore | 1 + > >> s390x/Makefile | 6 ++++-- > >> s390x/{flat.lds => flat.lds.S} | 0 > >> s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 > >> s390x/snippets/c/{flat.lds => flat.lds.S} | 0 > >> 5 files changed, 5 insertions(+), 2 deletions(-) > >> rename s390x/{flat.lds => flat.lds.S} (100%) > >> rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) > >> rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%) > >> > >> diff --git a/.gitignore b/.gitignore > >> index 601822d67325..29f352c5ceb6 100644 > >> --- a/.gitignore > >> +++ b/.gitignore > >> @@ -31,3 +31,4 @@ cscope.* > >> /s390x/comm.key > >> /s390x/snippets/*/*.hdr > >> /s390x/snippets/*/*.*obj > >> +/s390x/**/*.lds > > > > why ** ? > > Because all of our linker scripts are generated now: > > s390x/snippets/(c|asm)/*.lds > > and > > s390x/*.lds > > […snip] > ok so I thought ** was a typo and you meant either * or */*, but it turns out ** is actual a special glob syntax in gitignore ignore my comments regarding ** :)
diff --git a/.gitignore b/.gitignore index 601822d67325..29f352c5ceb6 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ cscope.* /s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj +/s390x/**/*.lds diff --git a/s390x/Makefile b/s390x/Makefile index 31f6db11213d..45493160cdf8 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -76,7 +76,7 @@ CFLAGS += -fno-delete-null-pointer-checks LDFLAGS += -nostdlib -Wl,--build-id=none # We want to keep intermediate files -.PRECIOUS: %.o +.PRECIOUS: %.o %.lds asm-offsets = lib/$(ARCH)/asm-offsets.h include $(SRCDIR)/scripts/asm-offsets.mak @@ -159,6 +159,8 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDI %.hdr.obj: %.hdr $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ +%.lds: %.lds.S + $(CPP) $(autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< .SECONDEXPANSION: %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o @@ -211,7 +213,7 @@ $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets) arch_clean: asm_offsets_clean - $(RM) $(TEST_DIR)/*.{o,elf,bin} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) + $(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) generated-files = $(asm-offsets) $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files) diff --git a/s390x/flat.lds b/s390x/flat.lds.S similarity index 100% rename from s390x/flat.lds rename to s390x/flat.lds.S diff --git a/s390x/snippets/asm/flat.lds b/s390x/snippets/asm/flat.lds.S similarity index 100% rename from s390x/snippets/asm/flat.lds rename to s390x/snippets/asm/flat.lds.S diff --git a/s390x/snippets/c/flat.lds b/s390x/snippets/c/flat.lds.S similarity index 100% rename from s390x/snippets/c/flat.lds rename to s390x/snippets/c/flat.lds.S
Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts" `*.lds.S`. Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> --- .gitignore | 1 + s390x/Makefile | 6 ++++-- s390x/{flat.lds => flat.lds.S} | 0 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 s390x/snippets/c/{flat.lds => flat.lds.S} | 0 5 files changed, 5 insertions(+), 2 deletions(-) rename s390x/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)