From 12400dcc0f3a4be8d1d165dc2b3a9f0bb9b579f0 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 8 Apr 2019 16:57:51 +0930 Subject: [PATCH] te-cloudabi.h This patch is aimed a fixing large numbers of x86_64-cloudabi failures caused by gas selecting the wrong target name. * config/te-cloudabi.h: New file. * config/tc-aarch64.c (aarch64_after_parse_args): Use TE_CLOUDABI rather than TARGET_OS to select cloudabi. * config/tc-i386.h (ELF_TARGET_FORMAT64): Define for TE_CLOUDABI. * configure.tgt (*-*-cloudabi*): Set em=cloudabi. --- gas/ChangeLog | 8 ++++++++ gas/config/tc-aarch64.c | 13 ++++++++----- gas/config/tc-i386.h | 2 ++ gas/config/te-cloudabi.h | 22 ++++++++++++++++++++++ gas/configure.tgt | 2 +- 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 gas/config/te-cloudabi.h diff --git a/gas/ChangeLog b/gas/ChangeLog index 354aae1..4ca3bae 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2019-04-10 Alan Modra + + * config/te-cloudabi.h: New file. + * config/tc-aarch64.c (aarch64_after_parse_args): Use TE_CLOUDABI + rather than TARGET_OS to select cloudabi. + * config/tc-i386.h (ELF_TARGET_FORMAT64): Define for TE_CLOUDABI. + * configure.tgt (*-*-cloudabi*): Set em=cloudabi. + 2019-04-09 Robert Suchanek * testsuite/gas/mips/mips.exp: Run hwr-names test. diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index d04e9a1..8008cd8 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -8331,15 +8331,18 @@ aarch64_after_parse_args (void) const char * elf64_aarch64_target_format (void) { - if (strcmp (TARGET_OS, "cloudabi") == 0) - { - /* FIXME: What to do for ilp32_p ? */ - return target_big_endian ? "elf64-bigaarch64-cloudabi" : "elf64-littleaarch64-cloudabi"; - } +#ifdef TE_CLOUDABI + /* FIXME: What to do for ilp32_p ? */ + if (target_big_endian) + return "elf64-bigaarch64-cloudabi"; + else + return "elf64-littleaarch64-cloudabi"; +#else if (target_big_endian) return ilp32_p ? "elf32-bigaarch64" : "elf64-bigaarch64"; else return ilp32_p ? "elf32-littleaarch64" : "elf64-littleaarch64"; +#endif } void diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 1f740e4..b02a256 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -63,6 +63,8 @@ extern unsigned long i386_mach (void); #define ELF_TARGET_FORMAT "elf32-i386-nacl" #define ELF_TARGET_FORMAT32 "elf32-x86-64-nacl" #define ELF_TARGET_FORMAT64 "elf64-x86-64-nacl" +#elif defined TE_CLOUDABI +#define ELF_TARGET_FORMAT64 "elf64-x86-64-cloudabi" #endif #ifdef TE_SOLARIS diff --git a/gas/config/te-cloudabi.h b/gas/config/te-cloudabi.h new file mode 100644 index 0000000..6ddbbd6 --- /dev/null +++ b/gas/config/te-cloudabi.h @@ -0,0 +1,22 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3, + or (at your option) any later version. + + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#define TE_CLOUDABI + +#include "obj-format.h" diff --git a/gas/configure.tgt b/gas/configure.tgt index e342acb..2d08c09 100644 --- a/gas/configure.tgt +++ b/gas/configure.tgt @@ -423,7 +423,7 @@ case ${generic_target} in z8k-*-coff | z8k-*-sim) fmt=coff ;; *-*-aout | *-*-scout) fmt=aout ;; - *-*-cloudabi*) fmt=elf ;; + *-*-cloudabi*) fmt=elf em=cloudabi ;; *-*-dragonfly*) fmt=elf em=dragonfly ;; *-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;; *-*-generic) fmt=generic ;; -- 2.7.4