* [kvm-unit-tests PATCH] arm & powerpc: populate argv[0] fixups
@ 2016-07-12 8:18 Andrew Jones
0 siblings, 0 replies; only message in thread
From: Andrew Jones @ 2016-07-12 8:18 UTC (permalink / raw)
To: kvm; +Cc: pbonzini
* Fix powerpc builds, we can't pass $(LDFLAGS) to $(CC)
* Fix argv[0] name to include dir and suffix, like x86 has.
* Satisfy Drew's OCD by adding 'e' to all prognam variables,
matching the more popular variable name (says Google) used
by Paolo, PROGNAME.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
arm/Makefile.common | 3 ++-
lib/argv.c | 6 +++---
lib/arm/setup.c | 4 ++--
lib/auxinfo.h | 2 +-
lib/powerpc/setup.c | 4 ++--
powerpc/Makefile.common | 9 +++++----
6 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/arm/Makefile.common b/arm/Makefile.common
index be99a4a2390e5..ccb554d9251a4 100644
--- a/arm/Makefile.common
+++ b/arm/Makefile.common
@@ -54,7 +54,8 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
%.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o)
$(CC) $(LDFLAGS) -o $@ \
-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
- $(filter %.o, $^) $(FLATLIBS) lib/auxinfo.c -DPROGNAME=\"$(*F)\"
+ $(filter %.o, $^) $(FLATLIBS) \
+ lib/auxinfo.c -DPROGNAME=\"$(@:.elf=.flat)\"
%.flat: %.elf
$(OBJCOPY) -O binary $^ $@
diff --git a/lib/argv.c b/lib/argv.c
index d6db685b7a941..482ed004ee64c 100644
--- a/lib/argv.c
+++ b/lib/argv.c
@@ -43,11 +43,11 @@ void setup_args(char *args)
__setup_args();
}
-void setup_args_prognam(char *args)
+void setup_args_progname(char *args)
{
__argv[0] = copy_ptr;
- strcpy(__argv[0], auxinfo.prognam);
- copy_ptr += strlen(auxinfo.prognam) + 1;
+ strcpy(__argv[0], auxinfo.progname);
+ copy_ptr += strlen(auxinfo.progname) + 1;
++__argc;
if (args) {
__args = args;
diff --git a/lib/arm/setup.c b/lib/arm/setup.c
index c27cc8d052f03..7e7b39f11dde1 100644
--- a/lib/arm/setup.c
+++ b/lib/arm/setup.c
@@ -22,7 +22,7 @@
extern unsigned long stacktop;
extern void io_init(void);
-extern void setup_args_prognam(const char *args);
+extern void setup_args_progname(const char *args);
u32 cpus[NR_CPUS] = { [0 ... NR_CPUS-1] = (~0U) };
int nr_cpus;
@@ -124,5 +124,5 @@ void setup(const void *fdt)
ret = dt_get_bootargs(&bootargs);
assert(ret == 0);
- setup_args_prognam(bootargs);
+ setup_args_progname(bootargs);
}
diff --git a/lib/auxinfo.h b/lib/auxinfo.h
index 18510bac96fd2..ef2376b4aca7f 100644
--- a/lib/auxinfo.h
+++ b/lib/auxinfo.h
@@ -1,7 +1,7 @@
#ifndef _AUXINFO_H_
#define _AUXINFO_H_
struct auxinfo {
- const char *prognam;
+ const char *progname;
};
/* No extern! Define a common symbol. */
diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c
index 82e1346b4a27c..e3d2afa31a59f 100644
--- a/lib/powerpc/setup.c
+++ b/lib/powerpc/setup.c
@@ -20,7 +20,7 @@
extern unsigned long stacktop;
extern void io_init(void);
-extern void setup_args_prognam(const char *args);
+extern void setup_args_progname(const char *args);
u32 cpus[NR_CPUS] = { [0 ... NR_CPUS-1] = (~0U) };
int nr_cpus;
@@ -164,5 +164,5 @@ void setup(const void *fdt)
ret = dt_get_bootargs(&bootargs);
assert(ret == 0);
- setup_args_prognam(bootargs);
+ setup_args_progname(bootargs);
}
diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
index bbad9c763a7d4..3f8887daa8423 100644
--- a/powerpc/Makefile.common
+++ b/powerpc/Makefile.common
@@ -41,10 +41,11 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive)
%.elf: CFLAGS += $(arch_CFLAGS)
%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie
%.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
- -Wl,-T,powerpc/flat.lds -Wl,--build-id=none \
- $(filter %.o, $^) $(FLATLIBS) \
- lib/auxinfo.c -DPROGNAME=\"$*\"
+ $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) lib/auxinfo.c -DPROGNAME=\"$@\"
+ $(LD) $(LDFLAGS) -o $@ \
+ -T powerpc/flat.lds --build-id=none \
+ $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o)
+ $(RM) $(@:.elf=.aux.o)
@echo -n Checking $@ for unsupported reloc types...
@if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \
false; \
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-07-12 8:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-12 8:18 [kvm-unit-tests PATCH] arm & powerpc: populate argv[0] fixups Andrew Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).