diff mbox

[kvm-unit-tests] powerpc: add -n to LDFLAGS

Message ID 1489141832-3754-1-git-send-email-clg@kaod.org
State Accepted
Headers show

Commit Message

Cédric Le Goater March 10, 2017, 10:30 a.m. UTC
ld 2.28 complains with :

  ld -EL -nostdlib -pie -o powerpc/selftest.elf \
          -T powerpc/flat.lds --build-id=none \
          powerpc/selftest.o powerpc/cstart64.o powerpc/reloc64.o lib/libcflat.a lib/libfdt/libfdt.a powerpc/selftest.aux.o
  ld: powerpc/selftest.elf: Not enough room for program headers, try linking with -N
  ld: final link failed: Bad value

Fix that by turning off page alignment of sections with option '-n'

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 powerpc/Makefile.common | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Huth March 10, 2017, 10:45 a.m. UTC | #1
On 10.03.2017 11:30, Cédric Le Goater wrote:
> ld 2.28 complains with :
> 
>   ld -EL -nostdlib -pie -o powerpc/selftest.elf \
>           -T powerpc/flat.lds --build-id=none \
>           powerpc/selftest.o powerpc/cstart64.o powerpc/reloc64.o lib/libcflat.a lib/libfdt/libfdt.a powerpc/selftest.aux.o
>   ld: powerpc/selftest.elf: Not enough room for program headers, try linking with -N
>   ld: final link failed: Bad value
> 
> Fix that by turning off page alignment of sections with option '-n'
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  powerpc/Makefile.common | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
> index 37f8caa720b7..1869f449b9ac 100644
> --- a/powerpc/Makefile.common
> +++ b/powerpc/Makefile.common
> @@ -42,7 +42,7 @@ cflatobjs += lib/powerpc/smp.o
>  
>  FLATLIBS = $(libcflat) $(LIBFDT_archive)
>  %.elf: CFLAGS += $(arch_CFLAGS)
> -%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie
> +%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie -n
>  %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o)
>  	$(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) lib/auxinfo.c -DPROGNAME=\"$@\"
>  	$(LD) $(LDFLAGS) -o $@ \

Reviewed-by: Thomas Huth <thuth@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Radim Krčmář March 15, 2017, 5:11 p.m. UTC | #2
2017-03-10 11:30+0100, Cédric Le Goater:
> ld 2.28 complains with :
> 
>   ld -EL -nostdlib -pie -o powerpc/selftest.elf \
>           -T powerpc/flat.lds --build-id=none \
>           powerpc/selftest.o powerpc/cstart64.o powerpc/reloc64.o lib/libcflat.a lib/libfdt/libfdt.a powerpc/selftest.aux.o
>   ld: powerpc/selftest.elf: Not enough room for program headers, try linking with -N
>   ld: final link failed: Bad value
> 
> Fix that by turning off page alignment of sections with option '-n'
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Applied, thanks.

>  powerpc/Makefile.common | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
> index 37f8caa720b7..1869f449b9ac 100644
> --- a/powerpc/Makefile.common
> +++ b/powerpc/Makefile.common
> @@ -42,7 +42,7 @@ cflatobjs += lib/powerpc/smp.o
>  
>  FLATLIBS = $(libcflat) $(LIBFDT_archive)
>  %.elf: CFLAGS += $(arch_CFLAGS)
> -%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie
> +%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie -n
>  %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o)
>  	$(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) lib/auxinfo.c -DPROGNAME=\"$@\"
>  	$(LD) $(LDFLAGS) -o $@ \
> -- 
> 2.7.4
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
index 37f8caa720b7..1869f449b9ac 100644
--- a/powerpc/Makefile.common
+++ b/powerpc/Makefile.common
@@ -42,7 +42,7 @@  cflatobjs += lib/powerpc/smp.o
 
 FLATLIBS = $(libcflat) $(LIBFDT_archive)
 %.elf: CFLAGS += $(arch_CFLAGS)
-%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie
+%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie -n
 %.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o)
 	$(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) lib/auxinfo.c -DPROGNAME=\"$@\"
 	$(LD) $(LDFLAGS) -o $@ \