Skip to contentSkip to conversation

linux-user: fix dependencies, forbid unknown host arch

PATCH In review Peter Maydell 3 participants 17 messages Jun 14, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

cover linux-user: fix dependencies, forbid unknown host arch

The main aim of this patchset is to fix a problem with the dependency handling of the hostdep.h files added in in commit 4d330cee37a21. It needs to be applied before we add any more architecture-specific hostdep.h files (ie before rth's patchset for ppc/arm/i386/s390/etc).

The intent of commit 4d330cee3 was that host architectures which needed a hostdep.h could provide it, and the build system would automatically fall back to a generic version if there was no version for the host architecture. Although this works, it has a flaw: if a subsequent commit switches an architecture from "uses generic/hostdep.h" to "uses its own hostdep.h" nothing in the makefile dependencies notices this and so doing a rebuild without a manual 'make clean' will fail.

So we drop the idea of having a 'generic' version in favour of every architecture we support having its own hostdep.h, even if it doesn't have anything in it. (There are only thirteen of these.)

There is an oddball corner case for linux-user which is that we were permitting 'unknown' host architectures in configure even though we need to know about the host CPU architecture for linux-user to work (in particular user-exec.c has code for handling signals that needs to know about that host's context structures). Cleaning this up first means we don't need to have a weird and mostly useless unknown/hostdep.h. The only two configurations which could in theory use ARCH=unknown without failing to compile due to missing user-exec.c support are:
* linux-user targets on M68K hosts using TCI
* linux-user targets on HPPA hosts using TCI

I doubt anybody is actually trying to use these in practice, though:
* interpreted TCG on a slow host CPU would be unusably slow
* the m68k user-exec.c support is missing is_write detection so guest code which writes to the same page it is executing from was broken (will include any guest program using signals)
* HPPA TCG backend support was dropped two and a half years ago with no complaints

So rather than raising m68k or hppa to "actually known architecture" this patchset drops support for them entirely as linux-user hosts, and deletes the now-unused code from user-exec.c. A bonus extra patch removes some OSX code from user-exec.c which hasn't been used since we dropped darwin-user.

thanks
-- PMM

Peter Maydell (5):
configure: Don't override ARCH=unknown if enabling TCI
configure: Don't allow user-only targets for unknown CPU architectures
user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code
user-exec: Remove unused code for OSX hosts
linux-user: Create a hostdep.h for each host architecture

 Makefile.target                   |   5 +-
 configure                         |   8 ++-
 linux-user/host/aarch64/hostdep.h |  15 ++++++
 linux-user/host/arm/hostdep.h     |  15 ++++++
 linux-user/host/generic/hostdep.h |  20 -------
 linux-user/host/i386/hostdep.h    |  15 ++++++
 linux-user/host/ia64/hostdep.h    |  15 ++++++
 linux-user/host/mips/hostdep.h    |  15 ++++++
 linux-user/host/ppc/hostdep.h     |  15 ++++++
 linux-user/host/ppc64/hostdep.h   |  15 ++++++
 linux-user/host/s390/hostdep.h    |  15 ++++++
 linux-user/host/s390x/hostdep.h   |  15 ++++++
 linux-user/host/sparc/hostdep.h   |  15 ++++++
 linux-user/host/sparc64/hostdep.h |  15 ++++++
 linux-user/host/x32/hostdep.h     |  15 ++++++
 user-exec.c                       | 107 +-------------------------------------
 16 files changed, 189 insertions(+), 131 deletions(-)
 create mode 100644 linux-user/host/aarch64/hostdep.h
 create mode 100644 linux-user/host/arm/hostdep.h
 delete mode 100644 linux-user/host/generic/hostdep.h
 create mode 100644 linux-user/host/i386/hostdep.h
 create mode 100644 linux-user/host/ia64/hostdep.h
 create mode 100644 linux-user/host/mips/hostdep.h
 create mode 100644 linux-user/host/ppc/hostdep.h
 create mode 100644 linux-user/host/ppc64/hostdep.h
 create mode 100644 linux-user/host/s390/hostdep.h
 create mode 100644 linux-user/host/s390x/hostdep.h
 create mode 100644 linux-user/host/sparc/hostdep.h
 create mode 100644 linux-user/host/sparc64/hostdep.h
 create mode 100644 linux-user/host/x32/hostdep.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/5 configure: Don't override ARCH=unknown if enabling TCI

At the moment if configure finds an unknown CPU it will set ARCH to 'unknown', and then later either bail out or set it to 'tci' (depending on whether the user passed configure the --enable-tcg-interpreter switch). This is unnecessarily confusing, because we could be using TCI in two cases:
* a known host architecture (in which case ARCH is set to the actual host architecture, like 'i386')
* an unknown host architecture (in which case ARCH is set to 'tci')
so nothing can rely on ARCH=tci to mean "using TCI". Remove the line setting ARCH, so we leave it as "unknown", which is what the actual situation is.

---
 configure | 1 -
 1 file changed, 1 deletion(-)
configure +0 -1
index 8c2f90b..7ab4e0b 100755
@@ -1381,7 +1381,6 @@ fi
 if test "$ARCH" = "unknown"; then
     if test "$tcg_interpreter" = "yes" ; then
         echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
-        ARCH=tci
     else
         error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
     fi
Signature · 1 line
1.9.1
Reviewed-by on v1 1/5
#2 lore raw

Re: [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI

Quoted 13 lines · Peter Maydell

At the moment if configure finds an unknown CPU it will set ARCH to 'unknown', and then later either bail out or set it to 'tci' (depending on whether the user passed configure the --enable-tcg-interpreter switch). This is unnecessarily confusing, because we could be using TCI in two cases:
* a known host architecture (in which case ARCH is set to the actual host architecture, like 'i386')
* an unknown host architecture (in which case ARCH is set to 'tci')
so nothing can rely on ARCH=tci to mean "using TCI". Remove the line setting ARCH, so we leave it as "unknown", which is what the actual situation is.

Quoted 1 line
Quoted 17 lines
---
 configure | 1 -
 1 file changed, 1 deletion(-)
configure +0 -1
index 8c2f90b..7ab4e0b 100755
@@ -1381,7 +1381,6 @@ fi
 if test "$ARCH" = "unknown"; then
     if test "$tcg_interpreter" = "yes" ; then
         echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
-        ARCH=tci
     else
         error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
     fi
Reviewed-by
#3 lore raw

Re: [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI

Quoted 16 lines · Laurent Vivier
Quoted 13 lines · Peter Maydell

At the moment if configure finds an unknown CPU it will set ARCH to 'unknown', and then later either bail out or set it to 'tci' (depending on whether the user passed configure the --enable-tcg-interpreter switch). This is unnecessarily confusing, because we could be using TCI in two cases:
* a known host architecture (in which case ARCH is set to the actual host architecture, like 'i386')
* an unknown host architecture (in which case ARCH is set to 'tci')
so nothing can rely on ARCH=tci to mean "using TCI". Remove the line setting ARCH, so we leave it as "unknown", which is what the actual situation is.

Quoted 3 lines
Quoted 1 line

oops...

To match the email address:

Thansk,
Laurent

Quoted 19 lines
Quoted 18 lines
---
 configure | 1 -
 1 file changed, 1 deletion(-)
configure +0 -1
index 8c2f90b..7ab4e0b 100755
@@ -1381,7 +1381,6 @@ fi
 if test "$ARCH" = "unknown"; then
     if test "$tcg_interpreter" = "yes" ; then
         echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
-        ARCH=tci
     else
         error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
     fi
Reviewed-by on v1 1/5
#4 lore raw

Re: [Qemu-devel] [PATCH 1/5] configure: Don't override ARCH=unknown if enabling TCI

In reply to Peter Maydell
Quoted 13 lines · Peter Maydell

At the moment if configure finds an unknown CPU it will set ARCH to 'unknown', and then later either bail out or set it to 'tci' (depending on whether the user passed configure the --enable-tcg-interpreter switch). This is unnecessarily confusing, because we could be using TCI in two cases:
* a known host architecture (in which case ARCH is set to the actual host architecture, like 'i386')
* an unknown host architecture (in which case ARCH is set to 'tci')
so nothing can rely on ARCH=tci to mean "using TCI". Remove the line setting ARCH, so we leave it as "unknown", which is what the actual situation is.

Quoted 4 lines
---
 configure | 1 -
 1 file changed, 1 deletion(-)

r~

#5 lore raw

PATCH 2/5 configure: Don't allow user-only targets for unknown CPU architectures

In reply to Peter Maydell

For the user-only targets, we need to know something about the host CPU architecture even if we are using the TCI interpreter rather than TCG. (In particular user-exec.c has code for handling signals that needs to know about that host's context structures.)

Specifically forbid building the user-only targets on unknown CPU architectures, rather than allowing them to configure but then fail when building user-exec.c.

This change drops supports for two configurations which were theoretically possible before:
* linux-user targets on M68K hosts using TCI
* linux-user targets on HPPA hosts using TCI

We don't think anybody is actually trying to use these in practice, though:
* interpreted TCG on a slow host CPU would be unusably slow
* the m68k user-exec.c support is missing is_write detection so guest code which writes to the same page it is executing from was broken (will include any guest program using signals)
* HPPA TCG backend support was dropped two and a half years ago with no complaints

---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)
configure +7 -0
index 7ab4e0b..62f93e3 100755
@@ -1217,6 +1217,13 @@ esac
 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
 
+# For user-mode emulation the host arch has to be one we explicitly
+# support, even if we're using TCI.
+if [ "$ARCH" = "unknown" ]; then
+  bsd_user="no"
+  linux_user="no"
+fi
+
 default_target_list=""
 
 mak_wilds=""
Signature · 1 line
1.9.1
Reviewed-by on v1 2/5
#6 lore raw

Re: [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures

Quoted 22 lines · Peter Maydell

For the user-only targets, we need to know something about the host CPU architecture even if we are using the TCI interpreter rather than TCG. (In particular user-exec.c has code for handling signals that needs to know about that host's context structures.)

Specifically forbid building the user-only targets on unknown CPU architectures, rather than allowing them to configure but then fail when building user-exec.c.

This change drops supports for two configurations which were theoretically possible before:
* linux-user targets on M68K hosts using TCI
* linux-user targets on HPPA hosts using TCI

We don't think anybody is actually trying to use these in practice, though:
* interpreted TCG on a slow host CPU would be unusably slow
* the m68k user-exec.c support is missing is_write detection so guest code which writes to the same page it is executing from was broken (will include any guest program using signals)
* HPPA TCG backend support was dropped two and a half years ago with no complaints

Quoted 1 line
Quoted 23 lines
---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)
configure +7 -0
index 7ab4e0b..62f93e3 100755
@@ -1217,6 +1217,13 @@ esac
 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
 
+# For user-mode emulation the host arch has to be one we explicitly
+# support, even if we're using TCI.
+if [ "$ARCH" = "unknown" ]; then
+  bsd_user="no"
+  linux_user="no"
+fi
+
 default_target_list=""
 
 mak_wilds=""
Reviewed-by on v1 2/5
#7 lore raw

Re: [Qemu-devel] [PATCH 2/5] configure: Don't allow user-only targets for unknown CPU architectures

In reply to Peter Maydell
Quoted 22 lines · Peter Maydell

For the user-only targets, we need to know something about the host CPU architecture even if we are using the TCI interpreter rather than TCG. (In particular user-exec.c has code for handling signals that needs to know about that host's context structures.)

Specifically forbid building the user-only targets on unknown CPU architectures, rather than allowing them to configure but then fail when building user-exec.c.

This change drops supports for two configurations which were theoretically possible before:
* linux-user targets on M68K hosts using TCI
* linux-user targets on HPPA hosts using TCI

We don't think anybody is actually trying to use these in practice, though:
* interpreted TCG on a slow host CPU would be unusably slow
* the m68k user-exec.c support is missing is_write detection so guest code which writes to the same page it is executing from was broken (will include any guest program using signals)
* HPPA TCG backend support was dropped two and a half years ago with no complaints

Quoted 4 lines
---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)

r~

#8 lore raw

PATCH 3/5 user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code

In reply to Peter Maydell

Now that configure blocks attempts to build user-mode code on hppa and m68k hosts, we can delete the cpu_signal_handler() implementations for those architectures.

---
 user-exec.c | 60 ------------------------------------------------------------
 1 file changed, 60 deletions(-)
user-exec.c +0 -60
index 50e95a6..1e2449e 100644
@@ -494,24 +494,6 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
                              is_write, &uc->uc_sigmask);
 }
 
-#elif defined(__mc68000)
-
-int cpu_signal_handler(int host_signum, void *pinfo,
-                       void *puc)
-{
-    siginfo_t *info = pinfo;
-    struct ucontext *uc = puc;
-    unsigned long pc;
-    int is_write;
-
-    pc = uc->uc_mcontext.gregs[16];
-    /* XXX: compute is_write */
-    is_write = 0;
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
-                             is_write,
-                             &uc->uc_sigmask);
-}
-
 #elif defined(__ia64)
 
 #ifndef __ISR_VALID
@@ -616,48 +598,6 @@ int cpu_signal_handler(int host_signum, void *pinfo,
                              is_write, &uc->uc_sigmask);
 }
 
-#elif defined(__hppa__)
-
-int cpu_signal_handler(int host_signum, void *pinfo,
-                       void *puc)
-{
-    siginfo_t *info = pinfo;
-    struct ucontext *uc = puc;
-    unsigned long pc = uc->uc_mcontext.sc_iaoq[0];
-    uint32_t insn = *(uint32_t *)pc;
-    int is_write = 0;
-
-    /* XXX: need kernel patch to get write flag faster.  */
-    switch (insn >> 26) {
-    case 0x1a: /* STW */
-    case 0x19: /* STH */
-    case 0x18: /* STB */
-    case 0x1b: /* STWM */
-        is_write = 1;
-        break;
-
-    case 0x09: /* CSTWX, FSTWX, FSTWS */
-    case 0x0b: /* CSTDX, FSTDX, FSTDS */
-        /* Distinguish from coprocessor load ... */
-        is_write = (insn >> 9) & 1;
-        break;
-
-    case 0x03:
-        switch ((insn >> 6) & 15) {
-        case 0xa: /* STWS */
-        case 0x9: /* STHS */
-        case 0x8: /* STBS */
-        case 0xe: /* STWAS */
-        case 0xc: /* STBYS */
-            is_write = 1;
-        }
-        break;
-    }
-
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
-                             is_write, &uc->uc_sigmask);
-}
-
 #else
 
 #error host CPU specific signal handler needed
Signature · 1 line
1.9.1
Reviewed-by on v1 3/5
#9 lore raw

Re: [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code

Quoted 5 lines · Peter Maydell

Now that configure blocks attempts to build user-mode code on hppa and m68k hosts, we can delete the cpu_signal_handler() implementations for those architectures.

Quoted 83 lines
---
 user-exec.c | 60 ------------------------------------------------------------
 1 file changed, 60 deletions(-)
user-exec.c +0 -60
index 50e95a6..1e2449e 100644
@@ -494,24 +494,6 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
                              is_write, &uc->uc_sigmask);
 }
 
-#elif defined(__mc68000)
-
-int cpu_signal_handler(int host_signum, void *pinfo,
-                       void *puc)
-{
-    siginfo_t *info = pinfo;
-    struct ucontext *uc = puc;
-    unsigned long pc;
-    int is_write;
-
-    pc = uc->uc_mcontext.gregs[16];
-    /* XXX: compute is_write */
-    is_write = 0;
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
-                             is_write,
-                             &uc->uc_sigmask);
-}
-
 #elif defined(__ia64)
 
 #ifndef __ISR_VALID
@@ -616,48 +598,6 @@ int cpu_signal_handler(int host_signum, void *pinfo,
                              is_write, &uc->uc_sigmask);
 }
 
-#elif defined(__hppa__)
-
-int cpu_signal_handler(int host_signum, void *pinfo,
-                       void *puc)
-{
-    siginfo_t *info = pinfo;
-    struct ucontext *uc = puc;
-    unsigned long pc = uc->uc_mcontext.sc_iaoq[0];
-    uint32_t insn = *(uint32_t *)pc;
-    int is_write = 0;
-
-    /* XXX: need kernel patch to get write flag faster.  */
-    switch (insn >> 26) {
-    case 0x1a: /* STW */
-    case 0x19: /* STH */
-    case 0x18: /* STB */
-    case 0x1b: /* STWM */
-        is_write = 1;
-        break;
-
-    case 0x09: /* CSTWX, FSTWX, FSTWS */
-    case 0x0b: /* CSTDX, FSTDX, FSTDS */
-        /* Distinguish from coprocessor load ... */
-        is_write = (insn >> 9) & 1;
-        break;
-
-    case 0x03:
-        switch ((insn >> 6) & 15) {
-        case 0xa: /* STWS */
-        case 0x9: /* STHS */
-        case 0x8: /* STBS */
-        case 0xe: /* STWAS */
-        case 0xc: /* STBYS */
-            is_write = 1;
-        }
-        break;
-    }
-
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
-                             is_write, &uc->uc_sigmask);
-}
-
 #else
 
 #error host CPU specific signal handler needed
Reviewed-by on v1 3/5
#10 lore raw

Re: [Qemu-devel] [PATCH 3/5] user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code

In reply to Peter Maydell
Quoted 8 lines · Peter Maydell

Now that configure blocks attempts to build user-mode code on hppa and m68k hosts, we can delete the cpu_signal_handler() implementations for those architectures.

---
 user-exec.c | 60 ------------------------------------------------------------
 1 file changed, 60 deletions(-)

r~

#11 lore raw

PATCH 4/5 user-exec: Remove unused code for OSX hosts

In reply to Peter Maydell

Since we dropped darwin-user support many years ago, the code in user-exec to support hosts which define __APPLE__ is unused; delete it.

---
 user-exec.c | 47 +----------------------------------------------
 1 file changed, 1 insertion(+), 46 deletions(-)
user-exec.c +1 -46
index 1e2449e..95f9f97 100644
@@ -117,14 +117,7 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 
 #if defined(__i386__)
 
-#if defined(__APPLE__)
-#include <sys/ucontext.h>
-
-#define EIP_sig(context)  (*((unsigned long *)&(context)->uc_mcontext->ss.eip))
-#define TRAP_sig(context)    ((context)->uc_mcontext->es.trapno)
-#define ERROR_sig(context)   ((context)->uc_mcontext->es.err)
-#define MASK_sig(context)    ((context)->uc_sigmask)
-#elif defined(__NetBSD__)
+#if defined(__NetBSD__)
 #include <ucontext.h>
 
 #define EIP_sig(context)     ((context)->uc_mcontext.__gregs[_REG_EIP])
@@ -274,44 +267,6 @@ int cpu_signal_handler(int host_signum, void *pinfo,
 #define TRAP_sig(context)              ((context)->uc_mcontext.mc_exc)
 #endif /* __FreeBSD__|| __FreeBSD_kernel__ */
 
-#ifdef __APPLE__
-#include <sys/ucontext.h>
-typedef struct ucontext SIGCONTEXT;
-/* All Registers access - only for local access */
-#define REG_sig(reg_name, context)              \
-    ((context)->uc_mcontext->ss.reg_name)
-#define FLOATREG_sig(reg_name, context)         \
-    ((context)->uc_mcontext->fs.reg_name)
-#define EXCEPREG_sig(reg_name, context)         \
-    ((context)->uc_mcontext->es.reg_name)
-#define VECREG_sig(reg_name, context)           \
-    ((context)->uc_mcontext->vs.reg_name)
-/* Gpr Registers access */
-#define GPR_sig(reg_num, context)              REG_sig(r##reg_num, context)
-/* Program counter */
-#define IAR_sig(context)                       REG_sig(srr0, context)
-/* Machine State Register (Supervisor) */
-#define MSR_sig(context)                       REG_sig(srr1, context)
-#define CTR_sig(context)                       REG_sig(ctr, context)
-/* Link register */
-#define XER_sig(context)                       REG_sig(xer, context)
-/* User's integer exception register */
-#define LR_sig(context)                        REG_sig(lr, context)
-/* Condition register */
-#define CR_sig(context)                        REG_sig(cr, context)
-/* Float Registers access */
-#define FLOAT_sig(reg_num, context)             \
-    FLOATREG_sig(fpregs[reg_num], context)
-#define FPSCR_sig(context)                      \
-    ((double)FLOATREG_sig(fpscr, context))
-/* Exception Registers access */
-/* Fault registers for coredump */
-#define DAR_sig(context)                       EXCEPREG_sig(dar, context)
-#define DSISR_sig(context)                     EXCEPREG_sig(dsisr, context)
-/* number of powerpc exception taken */
-#define TRAP_sig(context)                      EXCEPREG_sig(exception, context)
-#endif /* __APPLE__ */
-
 int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
Signature · 1 line
1.9.1
Reviewed-by on v1 4/5
#12 lore raw

Re: [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts

Quoted 4 lines · Peter Maydell

Since we dropped darwin-user support many years ago, the code in user-exec to support hosts which define __APPLE__ is unused; delete it.

Quoted 70 lines
---
 user-exec.c | 47 +----------------------------------------------
 1 file changed, 1 insertion(+), 46 deletions(-)
user-exec.c +1 -46
index 1e2449e..95f9f97 100644
@@ -117,14 +117,7 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 
 #if defined(__i386__)
 
-#if defined(__APPLE__)
-#include <sys/ucontext.h>
-
-#define EIP_sig(context)  (*((unsigned long *)&(context)->uc_mcontext->ss.eip))
-#define TRAP_sig(context)    ((context)->uc_mcontext->es.trapno)
-#define ERROR_sig(context)   ((context)->uc_mcontext->es.err)
-#define MASK_sig(context)    ((context)->uc_sigmask)
-#elif defined(__NetBSD__)
+#if defined(__NetBSD__)
 #include <ucontext.h>
 
 #define EIP_sig(context)     ((context)->uc_mcontext.__gregs[_REG_EIP])
@@ -274,44 +267,6 @@ int cpu_signal_handler(int host_signum, void *pinfo,
 #define TRAP_sig(context)              ((context)->uc_mcontext.mc_exc)
 #endif /* __FreeBSD__|| __FreeBSD_kernel__ */
 
-#ifdef __APPLE__
-#include <sys/ucontext.h>
-typedef struct ucontext SIGCONTEXT;
-/* All Registers access - only for local access */
-#define REG_sig(reg_name, context)              \
-    ((context)->uc_mcontext->ss.reg_name)
-#define FLOATREG_sig(reg_name, context)         \
-    ((context)->uc_mcontext->fs.reg_name)
-#define EXCEPREG_sig(reg_name, context)         \
-    ((context)->uc_mcontext->es.reg_name)
-#define VECREG_sig(reg_name, context)           \
-    ((context)->uc_mcontext->vs.reg_name)
-/* Gpr Registers access */
-#define GPR_sig(reg_num, context)              REG_sig(r##reg_num, context)
-/* Program counter */
-#define IAR_sig(context)                       REG_sig(srr0, context)
-/* Machine State Register (Supervisor) */
-#define MSR_sig(context)                       REG_sig(srr1, context)
-#define CTR_sig(context)                       REG_sig(ctr, context)
-/* Link register */
-#define XER_sig(context)                       REG_sig(xer, context)
-/* User's integer exception register */
-#define LR_sig(context)                        REG_sig(lr, context)
-/* Condition register */
-#define CR_sig(context)                        REG_sig(cr, context)
-/* Float Registers access */
-#define FLOAT_sig(reg_num, context)             \
-    FLOATREG_sig(fpregs[reg_num], context)
-#define FPSCR_sig(context)                      \
-    ((double)FLOATREG_sig(fpscr, context))
-/* Exception Registers access */
-/* Fault registers for coredump */
-#define DAR_sig(context)                       EXCEPREG_sig(dar, context)
-#define DSISR_sig(context)                     EXCEPREG_sig(dsisr, context)
-/* number of powerpc exception taken */
-#define TRAP_sig(context)                      EXCEPREG_sig(exception, context)
-#endif /* __APPLE__ */
-
 int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
Reviewed-by on v1 4/5
#13 lore raw

Re: [Qemu-devel] [PATCH 4/5] user-exec: Remove unused code for OSX hosts

In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

Since we dropped darwin-user support many years ago, the code in user-exec to support hosts which define __APPLE__ is unused; delete it.

---
 user-exec.c | 47 +----------------------------------------------
 1 file changed, 1 insertion(+), 46 deletions(-)

r~

#14 lore raw

PATCH 5/5 linux-user: Create a hostdep.h for each host architecture

In reply to Peter Maydell

In commit 4d330cee37a21 a new hostdep.h file was added, with the intent that host architectures which needed one could provide it, and the build system would automatically fall back to a generic version if there was no version for the host architecture. Although this works, it has a flaw: if a subsequent commit switches an architecture from "uses generic/hostdep.h" to "uses its own hostdep.h" nothing in the makefile dependencies notices this and so doing a rebuild without a manual 'make clean' will fail.

So we drop the idea of having a 'generic' version in favour of every architecture we support having its own hostdep.h, even if it doesn't have anything in it. (There are only thirteen of these.)

If the dependency files claim that an object file depends on a nonexistent file, our dependency system means that make will rebuild the object file, and regenerate the dependencies in the process. So moving between trees prior to this commit and trees after this commit works without requiring a 'make clean'.

---
 Makefile.target                   |  5 +----
 linux-user/host/aarch64/hostdep.h | 15 +++++++++++++++
 linux-user/host/arm/hostdep.h     | 15 +++++++++++++++
 linux-user/host/generic/hostdep.h | 20 --------------------
 linux-user/host/i386/hostdep.h    | 15 +++++++++++++++
 linux-user/host/ia64/hostdep.h    | 15 +++++++++++++++
 linux-user/host/mips/hostdep.h    | 15 +++++++++++++++
 linux-user/host/ppc/hostdep.h     | 15 +++++++++++++++
 linux-user/host/ppc64/hostdep.h   | 15 +++++++++++++++
 linux-user/host/s390/hostdep.h    | 15 +++++++++++++++
 linux-user/host/s390x/hostdep.h   | 15 +++++++++++++++
 linux-user/host/sparc/hostdep.h   | 15 +++++++++++++++
 linux-user/host/sparc64/hostdep.h | 15 +++++++++++++++
 linux-user/host/x32/hostdep.h     | 15 +++++++++++++++
 14 files changed, 181 insertions(+), 24 deletions(-)
 create mode 100644 linux-user/host/aarch64/hostdep.h
 create mode 100644 linux-user/host/arm/hostdep.h
 delete mode 100644 linux-user/host/generic/hostdep.h
 create mode 100644 linux-user/host/i386/hostdep.h
 create mode 100644 linux-user/host/ia64/hostdep.h
 create mode 100644 linux-user/host/mips/hostdep.h
 create mode 100644 linux-user/host/ppc/hostdep.h
 create mode 100644 linux-user/host/ppc64/hostdep.h
 create mode 100644 linux-user/host/s390/hostdep.h
 create mode 100644 linux-user/host/s390x/hostdep.h
 create mode 100644 linux-user/host/sparc/hostdep.h
 create mode 100644 linux-user/host/sparc64/hostdep.h
 create mode 100644 linux-user/host/x32/hostdep.h
Makefile.target +1 -4
index 495b474..b156799 100644
@@ -108,11 +108,8 @@ obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal128.o
 
 ifdef CONFIG_LINUX_USER
 
-# Note that we only add linux-user/host/$ARCH if it exists, and
-# that it must come before linux-user/host/generic in the search path.
 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
-             $(patsubst %,-I%,$(wildcard $(SRC_PATH)/linux-user/host/$(ARCH))) \
-             -I$(SRC_PATH)/linux-user/host/generic \
+             -I$(SRC_PATH)/linux-user/host/$(ARCH) \
              -I$(SRC_PATH)/linux-user
 
 obj-y += linux-user/
linux-user/host/aarch64/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/arm/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/generic/hostdep.h deleted +0 -20
deleted file mode 100644
index cfabc35..0000000
@@ -1,20 +0,0 @@
-/*
- * hostdep.h : fallback generic version of header for things
- * which are dependent on the host architecture
- *
- *  * Written by Peter Maydell <[email protected]>
- *
- * Copyright (C) 2016 Linaro Limited
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#ifndef QEMU_HOSTDEP_H
-#define QEMU_HOSTDEP_H
-
-/* This is the fallback header which is only used if the host
- * architecture doesn't provide one in linux-user/host/$ARCH.
- */
-
-#endif
linux-user/host/i386/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/ia64/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/mips/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/ppc/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/ppc64/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/s390/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/s390x/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/sparc/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/sparc64/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/x32/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
Signature · 1 line
1.9.1
Reviewed-by on v1 5/5
#15 lore raw

Re: [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture

Quoted 13 lines · Peter Maydell

In commit 4d330cee37a21 a new hostdep.h file was added, with the intent that host architectures which needed one could provide it, and the build system would automatically fall back to a generic version if there was no version for the host architecture. Although this works, it has a flaw: if a subsequent commit switches an architecture from "uses generic/hostdep.h" to "uses its own hostdep.h" nothing in the makefile dependencies notices this and so doing a rebuild without a manual 'make clean' will fail.

So we drop the idea of having a 'generic' version in favour of every architecture we support having its own hostdep.h, even if it doesn't have anything in it. (There are only thirteen of these.)

Quoted 7 lines

If the dependency files claim that an object file depends on a nonexistent file, our dependency system means that make will rebuild the object file, and regenerate the dependencies in the process. So moving between trees prior to this commit and trees after this commit works without requiring a 'make clean'.

Quoted 326 lines
---
 Makefile.target                   |  5 +----
 linux-user/host/aarch64/hostdep.h | 15 +++++++++++++++
 linux-user/host/arm/hostdep.h     | 15 +++++++++++++++
 linux-user/host/generic/hostdep.h | 20 --------------------
 linux-user/host/i386/hostdep.h    | 15 +++++++++++++++
 linux-user/host/ia64/hostdep.h    | 15 +++++++++++++++
 linux-user/host/mips/hostdep.h    | 15 +++++++++++++++
 linux-user/host/ppc/hostdep.h     | 15 +++++++++++++++
 linux-user/host/ppc64/hostdep.h   | 15 +++++++++++++++
 linux-user/host/s390/hostdep.h    | 15 +++++++++++++++
 linux-user/host/s390x/hostdep.h   | 15 +++++++++++++++
 linux-user/host/sparc/hostdep.h   | 15 +++++++++++++++
 linux-user/host/sparc64/hostdep.h | 15 +++++++++++++++
 linux-user/host/x32/hostdep.h     | 15 +++++++++++++++
 14 files changed, 181 insertions(+), 24 deletions(-)
 create mode 100644 linux-user/host/aarch64/hostdep.h
 create mode 100644 linux-user/host/arm/hostdep.h
 delete mode 100644 linux-user/host/generic/hostdep.h
 create mode 100644 linux-user/host/i386/hostdep.h
 create mode 100644 linux-user/host/ia64/hostdep.h
 create mode 100644 linux-user/host/mips/hostdep.h
 create mode 100644 linux-user/host/ppc/hostdep.h
 create mode 100644 linux-user/host/ppc64/hostdep.h
 create mode 100644 linux-user/host/s390/hostdep.h
 create mode 100644 linux-user/host/s390x/hostdep.h
 create mode 100644 linux-user/host/sparc/hostdep.h
 create mode 100644 linux-user/host/sparc64/hostdep.h
 create mode 100644 linux-user/host/x32/hostdep.h
Makefile.target +1 -4
index 495b474..b156799 100644
@@ -108,11 +108,8 @@ obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/dpd/decimal128.o
 
 ifdef CONFIG_LINUX_USER
 
-# Note that we only add linux-user/host/$ARCH if it exists, and
-# that it must come before linux-user/host/generic in the search path.
 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
-             $(patsubst %,-I%,$(wildcard $(SRC_PATH)/linux-user/host/$(ARCH))) \
-             -I$(SRC_PATH)/linux-user/host/generic \
+             -I$(SRC_PATH)/linux-user/host/$(ARCH) \
              -I$(SRC_PATH)/linux-user
 
 obj-y += linux-user/
linux-user/host/aarch64/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/arm/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/generic/hostdep.h deleted +0 -20
deleted file mode 100644
index cfabc35..0000000
@@ -1,20 +0,0 @@
-/*
- * hostdep.h : fallback generic version of header for things
- * which are dependent on the host architecture
- *
- *  * Written by Peter Maydell <[email protected]>
- *
- * Copyright (C) 2016 Linaro Limited
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#ifndef QEMU_HOSTDEP_H
-#define QEMU_HOSTDEP_H
-
-/* This is the fallback header which is only used if the host
- * architecture doesn't provide one in linux-user/host/$ARCH.
- */
-
-#endif
linux-user/host/i386/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/ia64/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/mips/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/ppc/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/ppc64/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/s390/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/s390x/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/sparc/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/sparc64/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
linux-user/host/x32/hostdep.h new file +15 -0
new file mode 100644
index 0000000..7609bf5
@@ -0,0 +1,15 @@
+/*
+ * hostdep.h : things which are dependent on the host architecture
+ *
+ *  * Written by Peter Maydell <[email protected]>
+ *
+ * Copyright (C) 2016 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_HOSTDEP_H
+#define QEMU_HOSTDEP_H
+
+#endif
Reviewed-by on v1 5/5
#16 lore raw

Re: [Qemu-devel] [PATCH 5/5] linux-user: Create a hostdep.h for each host architecture

In reply to Peter Maydell
Quoted 13 lines · Peter Maydell

In commit 4d330cee37a21 a new hostdep.h file was added, with the intent that host architectures which needed one could provide it, and the build system would automatically fall back to a generic version if there was no version for the host architecture. Although this works, it has a flaw: if a subsequent commit switches an architecture from "uses generic/hostdep.h" to "uses its own hostdep.h" nothing in the makefile dependencies notices this and so doing a rebuild without a manual 'make clean' will fail.

So we drop the idea of having a 'generic' version in favour of every architecture we support having its own hostdep.h, even if it doesn't have anything in it. (There are only thirteen of these.)

Quoted 8 lines

If the dependency files claim that an object file depends on a nonexistent file, our dependency system means that make will rebuild the object file, and regenerate the dependencies in the process. So moving between trees prior to this commit and trees after this commit works without requiring a 'make clean'.

---

r~