From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Vivier Date: Mon, 29 Feb 2016 17:53:13 +0000 Subject: Re: [kvm-unit-tests PATCH v2 2/2] powerpc: select endianness Message-Id: <56D48589.3080202@redhat.com> List-Id: References: <1456506526-10803-1-git-send-email-lvivier@redhat.com> <1456506526-10803-3-git-send-email-lvivier@redhat.com> <20160226184502.35oadt5jw2ck46la@hawk.localdomain> In-Reply-To: <20160226184502.35oadt5jw2ck46la@hawk.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andrew Jones Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, thuth@redhat.com, dgibson@redhat.com, agraf@suse.de, pbonzini@redhat.com On 26/02/2016 19:45, Andrew Jones wrote: ... >> diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common >> > index cc27ac8..b088af6 100644 >> > --- a/powerpc/Makefile.common >> > +++ b/powerpc/Makefile.common >> > @@ -11,14 +11,15 @@ all: $(TEST_DIR)/boot_rom.bin test_cases >> > >> > ################################################################## >> > >> > -CFLAGS += $(arch_CFLAGS) >> > -CFLAGS += -std=gnu99 >> > -CFLAGS += -ffreestanding >> > -CFLAGS += -Wextra >> > -CFLAGS += -O2 >> > -CFLAGS += -I lib -I lib/libfdt >> > -CFLAGS += -Wa,-mregnames >> > -CFLAGS += -fpie >> > +common_CFLAGS = -std=gnu99 >> > +common_CFLAGS += -ffreestanding >> > +common_CFLAGS += -Wextra >> > +common_CFLAGS += -O2 >> > +common_CFLAGS += -I lib -I lib/libfdt >> > +common_CFLAGS += -Wa,-mregnames >> > +common_CFLAGS += -fpie >> > + >> > +CFLAGS += $(arch_CFLAGS) $(common_CFLAGS) > I'm not sure what we gain by renaming to common_CFLAGS. Doesn't just > > %.elf: CFLAGS += $(arch_CFLAGS) > > work? > >> > >> > asm-offsets = lib/$(ARCH)/asm-offsets.h >> > include scripts/asm-offsets.mak >> > @@ -48,6 +49,7 @@ $(TEST_DIR)/boot_rom.bin: $(TEST_DIR)/boot_rom.elf >> > dd if=/dev/zero of=$@ bs%6 count=1 >> > $(OBJCOPY) -O binary $^ >(cat - >>$@) >> > >> > +$(TEST_DIR)/boot_rom.elf: CFLAGS = -mbig-endian $(common_CFLAGS) $(main_CFLAGS) > And just > $(TEST_DIR)/boot_rom.elf: CFLAGS += -mbig-endian > We can't do that because boot_rom.elf is also a .elf, so the both rules apply and we end up with in the case of boot_rom.elf (and --endian=little): CFLAGS += -mlittle-endian -mbig-endian and it doesn't work. We must overwrite CFLAGS in the case of boot_rom.elf. But boot_rom.S is a one line of assembly language, we don't need the other flags, in fact... Laurent