qemu/target/mips/tcg
Philippe Mathieu-Daudé d859a77dbd target/mips: Rewrite UHI errno_mips() using switch statement
Linking on Haiku OS fails:

  /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/8.3.0/../../../../x86_64-unknown-haiku/bin/ld:
  error: libqemu-mips-softmmu.fa.p/target_mips_tcg_sysemu_mips-semi.c.o(.rodata) is too large (0xffff405a bytes)
  /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/8.3.0/../../../../x86_64-unknown-haiku/bin/ld:
  final link failed: memory exhausted
  collect2: error: ld returned 1 exit status

This is because the host_to_mips_errno[] uses errno as index,
for example:

  static const uint16_t host_to_mips_errno[] = {
      [ENAMETOOLONG] = 91,
      ...

and Haiku defines [*] ENAMETOOLONG as:

   12 /* Error baselines */
   13 #define B_GENERAL_ERROR_BASE              INT_MIN
   ..
   22 #define B_STORAGE_ERROR_BASE              (B_GENERAL_ERROR_BASE + 0x6000)
  ...
  106 #define B_NAME_TOO_LONG                   (B_STORAGE_ERROR_BASE + 4)
  ...
  211 #define ENAMETOOLONG                      B_TO_POSIX_ERROR(B_NAME_TOO_LONG)

so the array ends up beeing indeed too big.

Since POSIX errno can't be use as indexes on Haiku,
rewrite errno_mips() using a switch statement.

[*] https://github.com/haiku/haiku/blob/r1beta3/headers/os/support/Errors.h#L130

Reported-by: Richard Zak <richard.j.zak@gmail.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210706130723.1178961-1-f4bug@amsat.org>
2021-07-11 22:29:54 +02:00
..
sysemu target/mips: Rewrite UHI errno_mips() using switch statement 2021-07-11 22:29:54 +02:00
user target/mips: Add simple user-mode mips_cpu_tlb_fill() 2021-05-02 16:49:35 +02:00
dsp_helper.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
exception.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
fpu_helper.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
ldst_helper.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
lmmi_helper.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
meson.build target/mips: Merge msa32/msa64 decodetree definitions 2021-06-24 16:48:08 +02:00
micromips_translate.c.inc target/mips: Extract the microMIPS ISA translation routines 2021-07-02 10:41:15 +02:00
mips16e_translate.c.inc target/mips: Extract Code Compaction ASE translation routines 2021-07-02 10:41:15 +02:00
mips32r6.decode target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
mips64r6.decode target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
msa_helper.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
msa_helper.h.inc target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
msa_translate.c target/mips: Merge msa32/msa64 decodetree definitions 2021-06-24 16:48:08 +02:00
msa.decode target/mips: Merge msa32/msa64 decodetree definitions 2021-06-24 16:48:08 +02:00
mxu_translate.c target/mips: Fix gen_mxu_s32ldd_s32lddr 2021-06-29 10:04:57 -07:00
nanomips_translate.c.inc target/mips: Extract nanoMIPS ISA translation routines 2021-07-02 10:41:16 +02:00
op_helper.c target/mips: Fold jazz behaviour into mips_cpu_do_transaction_failed 2021-05-26 15:33:59 -07:00
rel6_translate.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
sysemu_helper.h.inc target/mips: Move TLB management helpers to tcg/sysemu/tlb_helper.c 2021-05-02 16:49:35 +02:00
tcg-internal.h target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
trace-events target/mips: Move TCG trace events to tcg/ sub directory 2021-06-24 16:48:07 +02:00
trace.h target/mips: Move TCG trace events to tcg/ sub directory 2021-06-24 16:48:07 +02:00
translate_addr_const.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00
translate.c target/mips/tx79: Introduce LQ opcode (Load Quadword) 2021-07-11 22:29:54 +02:00
translate.h target/mips: Add declarations for generic TCG helpers 2021-07-02 10:41:15 +02:00
tx79_translate.c target/mips/tx79: Introduce SQ opcode (Store Quadword) 2021-07-11 22:29:54 +02:00
tx79.decode target/mips/tx79: Introduce SQ opcode (Store Quadword) 2021-07-11 22:29:54 +02:00
txx9_translate.c target/mips: Move TCG source files under tcg/ sub directory 2021-05-02 16:49:35 +02:00