Skip to contentSkip to conversation

ppc: make also linking work with big-endian tool chain

PATCH In review Jan Beulich 3 participants 6 messages Jul 5, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc: make also linking work with big-endian tool chain

Telling just the compiler to produce little-endian objects isn't enough.

xen/arch/ppc/arch.mk +2 -0
@@ -7,6 +7,8 @@ ppc-march-$(CONFIG_POWER_ISA_3_00) := po
 CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=large -mabi=elfv2 -mno-altivec -mno-vsx
 
+LDFLAGS += -m elf64lppc
+
 # TODO: Drop override when more of the build is working
 override ALL_OBJS-y = arch/$(SRCARCH)/built_in.o
 override ALL_LIBS-y =
Acked-by on v1 1/1
#1 lore raw

xen/arch/ppc/arch.mk ppc-march-$(CONFIG_POWER_ISA_3_00) := po · line 10

Quoted 11 lines · Jan Beulich

Telling just the compiler to produce little-endian objects isn't enough.

xen/arch/ppc/arch.mk +1 -0
@@ -7,6 +7,8 @@ ppc-march-$(CONFIG_POWER_ISA_3_00) := po
 CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=large -mabi=elfv2 -mno-altivec -mno-vsx
 
+LDFLAGS += -m elf64lppc

Looking around, it seems GNU ld also has a -EL flag:

-EL Link little-endian objects. This affects the default output format.

Linux's build system passes both -EL and -m elf64lppc, though I'm wondering if -EL alone would be enough.

In any case, this doesn't break the build with my ppc64le toolchain, so if this fixes issues you're seeing with BE toolchains then it's fine with me.

xen/arch/ppc/arch.mk ppc-march-$(CONFIG_POWER_ISA_3_00) := po · line 14

Quoted 3 lines
xen/arch/ppc/arch.mk +0 -0
 # TODO: Drop override when more of the build is working
 override ALL_OBJS-y = arch/$(SRCARCH)/built_in.o
 override ALL_LIBS-y =
#2 lore raw
Quoted 11 lines · Shawn Anastasio
Quoted 10 lines · Jan Beulich

Telling just the compiler to produce little-endian objects isn't enough.

xen/arch/ppc/arch.mk +0 -0
@@ -7,6 +7,8 @@ ppc-march-$(CONFIG_POWER_ISA_3_00) := po
 CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=large -mabi=elfv2 -mno-altivec -mno-vsx
 
Quoted 8 lines

xen/arch/ppc/arch.mk ppc-march-$(CONFIG_POWER_ISA_3_00) := po · line 10

Quoted 1 line
xen/arch/ppc/arch.mk +1 -0
+LDFLAGS += -m elf64lppc

Looking around, it seems GNU ld also has a -EL flag:

-EL Link little-endian objects. This affects the default output format.

Linux's build system passes both -EL and -m elf64lppc, though I'm wondering if -EL alone would be enough.

What I did is check what gcc passes to ld when itself passed -mlittle or -mlittle-endian.

Quoted 9 lines

In any case, this doesn't break the build with my ppc64le toolchain, so if this fixes issues you're seeing with BE toolchains then it's fine with me.

xen/arch/ppc/arch.mk ppc-march-$(CONFIG_POWER_ISA_3_00) := po · line 14

Quoted 3 lines
xen/arch/ppc/arch.mk +0 -0
 # TODO: Drop override when more of the build is working
 override ALL_OBJS-y = arch/$(SRCARCH)/built_in.o
 override ALL_LIBS-y =

Thanks.

Jan

#3 lore raw
Quoted 4 lines · Jan Beulich
Quoted 1 line · Shawn Anastasio

Thanks.

Just to clarify, as the maintainer of PPC64, would it be my responsibility to commit this now directly to xen/staging? Or should I commit it to my own tree and have someone pull it?

I'm not super familiar with the project's maintainer workflow yet so any hints would be appreciated.

Quoted 1 line

Jan

Thanks,
Shawn

#4 lore raw
Quoted 10 lines · Shawn Anastasio
Quoted 3 lines · Jan Beulich
Quoted 1 line · Shawn Anastasio

Thanks.

Just to clarify, as the maintainer of PPC64, would it be my responsibility to commit this now directly to xen/staging? Or should I commit it to my own tree and have someone pull it?

I'm not super familiar with the project's maintainer workflow yet so any hints would be appreciated.

Ah, so this is somewhere where we're quite different to Linux.

There is one single tree, and there are a small group of people with commit access.  We're "THE REST" in the maintainers file.  Jan can commit, as can I, and several others.

The role of committers is (technically at least) to take any patch from the mailing list which is suitably acked, and commit it.

So, in principle you have nothing further to do here.  As this is one of Jan's patches, I'm sure he'll include in in the next set of patches he commits.

It can happen that patches fall between the cracks, so it is generally helpful for maintainers to double check and ping on IRC/email/etc if there are patches that appear to be outstanding.

~Andrew

#5 lore raw
Quoted 25 lines · Andrew Cooper
Quoted 10 lines · Shawn Anastasio
Quoted 3 lines · Jan Beulich
Quoted 1 line · Shawn Anastasio

Thanks.

Just to clarify, as the maintainer of PPC64, would it be my responsibility to commit this now directly to xen/staging? Or should I commit it to my own tree and have someone pull it?

I'm not super familiar with the project's maintainer workflow yet so any hints would be appreciated.

Ah, so this is somewhere where we're quite different to Linux.

There is one single tree, and there are a small group of people with commit access. We're "THE REST" in the maintainers file. Jan can commit, as can I, and several others.

The role of committers is (technically at least) to take any patch from the mailing list which is suitably acked, and commit it.

So, in principle you have nothing further to do here. As this is one of Jan's patches, I'm sure he'll include in in the next set of patches he commits.

Quoted 5 lines

It can happen that patches fall between the cracks, so it is generally helpful for maintainers to double check and ping on IRC/email/etc if there are patches that appear to be outstanding.

~Andrew

Thanks for the explanation, that makes sense.

Shawn