[2/3] powerpc: use default endianness for converting guest/init

Submitted by Andre Przywara on June 17, 2015, 9:43 a.m.

Details

Message ID 1434534230-17249-3-git-send-email-andre.przywara@arm.com
State New
Headers show

Commit Message

Andre Przywara June 17, 2015, 9:43 a.m.
For converting the guest/init binary into an object file, we call
the linker binary, setting the endianness to big endian explicitly
when compiling kvmtool for powerpc.
This breaks if the compiler is actually targetting little endian
(which is true for the Debian port, for instance).
Remove the explicit big endianness switch from the linker call to
allow linking on little endian PowerPC builds again.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
Hi,

this fixed the powerpc64le build for me, while still compiling fine
for big endian. Admittedly this whole init->guest_init.o conversion
has its issues (with MIPS, for instance), which deserve proper fixing,
but lets just fix that build for now.

Andre.

 Makefile | 1 -
 1 file changed, 1 deletion(-)

Comments

Andre Przywara June 18, 2015, 2:52 p.m.
Hi,

On 06/17/2015 10:43 AM, Andre Przywara wrote:
> For converting the guest/init binary into an object file, we call
> the linker binary, setting the endianness to big endian explicitly
> when compiling kvmtool for powerpc.
> This breaks if the compiler is actually targetting little endian
> (which is true for the Debian port, for instance).
> Remove the explicit big endianness switch from the linker call to
> allow linking on little endian PowerPC builds again.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
> Hi,
> 
> this fixed the powerpc64le build for me, while still compiling fine
> for big endian. Admittedly this whole init->guest_init.o conversion
> has its issues (with MIPS, for instance), which deserve proper fixing,
> but lets just fix that build for now.
> 

Will was concerned about breaking toolchains where the linker does not
default to 64-bit. Is that an issue we care about?
AFAICT LDFLAGS is only used in this dodgy binary-to-object-file
conversion of guest/init. For this we rely on the resulting .o file to
have the same ELF target as the other object files to be finally linked
into the lkvm binary. As we don't compile guest/init with CFLAGS, there
is a possible mismatch.

I am looking into a proper fix for this now (compiling guest/init with
CFLAGS, calling $CC with linker options instead of $LD and allowing CC
and LD override). Still struggling with MIPS, though :-(

If someone is eager to fix compilation on PowerPC meanwhile, feel free
to use this fix for the time being.

Cheers,
Andre.

> 
>  Makefile | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 6110b8e..c118e1a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -149,7 +149,6 @@ ifeq ($(ARCH), powerpc)
>  	OBJS	+= powerpc/xics.o
>  	ARCH_INCLUDE := powerpc/include
>  	CFLAGS 	+= -m64
> -	LDFLAGS += -m elf64ppc
>  
>  	ARCH_WANT_LIBFDT := y
>  endif
> 
--
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

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index 6110b8e..c118e1a 100644
--- a/Makefile
+++ b/Makefile
@@ -149,7 +149,6 @@  ifeq ($(ARCH), powerpc)
 	OBJS	+= powerpc/xics.o
 	ARCH_INCLUDE := powerpc/include
 	CFLAGS 	+= -m64
-	LDFLAGS += -m elf64ppc
 
 	ARCH_WANT_LIBFDT := y
 endif