diff mbox series

[kvm-unit-tests,v1,1/2] s390x/Makefile: Make sure the linker script is generated in the build directory

Message ID 20250128100639.41779-2-mhartmay@linux.ibm.com (mailing list archive)
State New
Headers show
Series s390x: Improve out-of-source builds | expand

Commit Message

Marc Hartmayer Jan. 28, 2025, 10:06 a.m. UTC
This change makes sure that the 'flat.lds' linker script is actually generated
in the build directory and not source directory - this makes a difference in
case of an out-of-source build.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 s390x/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marc Hartmayer Jan. 28, 2025, 10:14 a.m. UTC | #1
On Tue, Jan 28, 2025 at 11:06 AM +0100, Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
> This change makes sure that the 'flat.lds' linker script is actually generated
> in the build directory and not source directory - this makes a difference in
> case of an out-of-source build.
>
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  s390x/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 23342bd64f44..71bfa787fe59 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -182,8 +182,8 @@ lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@
>  	$(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\"
>  
>  .SECONDEXPANSION:
> -%.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
> -	@$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \

> +%.elf: $(FLATLIBS) $(asmlib) s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
> +	@$(CC) $(LDFLAGS) -o $@ -T s390x/flat.lds \

s390x/flat.lds should be replaced by $(TESTDIR)/flat.lds

>  		$(filter %.o, $^) $(FLATLIBS) $(snippets-obj) $(snippet-hdr-obj) || \
>  		{ echo "Failure probably caused by missing definition of gen-se-header executable"; exit 1; }
>  	@chmod a-x $@
> -- 
> 2.48.1
>
>
Nico Boehr Jan. 31, 2025, 8:56 a.m. UTC | #2
On Tue Jan 28, 2025 at 11:06 AM CET, Marc Hartmayer wrote:
> This change makes sure that the 'flat.lds' linker script is actually generated
> in the build directory and not source directory - this makes a difference in
> case of an out-of-source build.
>
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>

Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Nico Boehr Jan. 31, 2025, 9:20 a.m. UTC | #3
On Tue Jan 28, 2025 at 11:14 AM CET, Marc Hartmayer wrote:
> On Tue, Jan 28, 2025 at 11:06 AM +0100, Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
> > This change makes sure that the 'flat.lds' linker script is actually generated
> > in the build directory and not source directory - this makes a difference in
> > case of an out-of-source build.
> >
> > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> > ---
> >  s390x/Makefile | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/s390x/Makefile b/s390x/Makefile
> > index 23342bd64f44..71bfa787fe59 100644
> > --- a/s390x/Makefile
> > +++ b/s390x/Makefile
> > @@ -182,8 +182,8 @@ lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@
> >  	$(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\"
> >  
> >  .SECONDEXPANSION:
> > -%.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
> > -	@$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \
>
> > +%.elf: $(FLATLIBS) $(asmlib) s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
> > +	@$(CC) $(LDFLAGS) -o $@ -T s390x/flat.lds \
>
> s390x/flat.lds should be replaced by $(TESTDIR)/flat.lds

fwiw, s/TESTDIR/TEST_DIR/

Otherwise, yes, will fix it up when picking. Thanks!
Marc Hartmayer Jan. 31, 2025, 9:28 a.m. UTC | #4
On Fri, Jan 31, 2025 at 10:20 AM +0100, "Nico Boehr" <nrb@linux.ibm.com> wrote:
> On Tue Jan 28, 2025 at 11:14 AM CET, Marc Hartmayer wrote:
>> On Tue, Jan 28, 2025 at 11:06 AM +0100, Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
>> > This change makes sure that the 'flat.lds' linker script is actually generated
>> > in the build directory and not source directory - this makes a difference in
>> > case of an out-of-source build.
>> >
>> > Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
>> > ---
>> >  s390x/Makefile | 4 ++--
>> >  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/s390x/Makefile b/s390x/Makefile
>> > index 23342bd64f44..71bfa787fe59 100644
>> > --- a/s390x/Makefile
>> > +++ b/s390x/Makefile
>> > @@ -182,8 +182,8 @@ lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@
>> >  	$(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\"
>> >  
>> >  .SECONDEXPANSION:
>> > -%.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
>> > -	@$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \
>>
>> > +%.elf: $(FLATLIBS) $(asmlib) s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
>> > +	@$(CC) $(LDFLAGS) -o $@ -T s390x/flat.lds \
>>
>> s390x/flat.lds should be replaced by $(TESTDIR)/flat.lds
>
> fwiw, s/TESTDIR/TEST_DIR/
>
> Otherwise, yes, will fix it up when picking. Thanks!

Thanks.
diff mbox series

Patch

diff --git a/s390x/Makefile b/s390x/Makefile
index 23342bd64f44..71bfa787fe59 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -182,8 +182,8 @@  lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@
 	$(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\"
 
 .SECONDEXPANSION:
-%.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
-	@$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \
+%.elf: $(FLATLIBS) $(asmlib) s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
+	@$(CC) $(LDFLAGS) -o $@ -T s390x/flat.lds \
 		$(filter %.o, $^) $(FLATLIBS) $(snippets-obj) $(snippet-hdr-obj) || \
 		{ echo "Failure probably caused by missing definition of gen-se-header executable"; exit 1; }
 	@chmod a-x $@