public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: binutils@sources.redhat.com
Subject: check mips abi x linker emulation compatibility
Date: Mon, 24 Mar 2003 07:41:00 -0000	[thread overview]
Message-ID: <orsmtdty9d.fsf@free.redhat.lsd.ic.unicamp.br> (raw)

[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]

We currently fail to reject attempts to link say mips ELF64 object
files using elfn32 or elf32 emulations, or N32 ELF32 objects using
elf32 or elf64 emulations.  This patch fixes this problem without
introducing regressions on mips-linux-gnu, but it's a disaster for the
linker testsuite in mips64-linux-gnu: the assembler generates ABI-less
elf32 code by default, which the linker rightfully recognizes as
elf32, thus rejecting to link it using the default n32 emulation.  I'm
thinking one way to fix the problem is to get the assembler to
actually choose an ABI as default.  Currently it just leaves mips_abi
set to NO_ABI through to the end of the compilation, which makes it
fail to set any of the ABI flag bits.  I'm thinking of doing it with
some triple-specific machinery, akin to what we currently use to set
MIPS_DEFAULT_64BIT.

I was thinking of doing the same change for Irix as well, however, now
I realize that the IRIX assembler doesn't default to n32, unlike the
compiler.  I'm not entirely sure on how to proceed: it seems that our
assembler matches IRIX's behavior, but the linker doesn't, the main
difference being that we fail to detect the emulation to be used from
the input object files.  I've no idea of how much effort it would be
to get GNU ld to do that, and I'm not entirely sure it's worth the
effort.

Meanwhile, I'm considering the possibility of switching the linker
default ABI on mips64-linux-gnu to o32, at least to get linker tests
to pass.  Comments?

Anyway, ok to install?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bfd-mips-check-abi-compat.patch --]
[-- Type: text/x-patch, Size: 1387 bytes --]

Index: bfd/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Improve
	error message for mixing different-endian files.  Check for ABI
	compatibility of input files with the selected emulation.

Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/uberbaum/bfd/elfxx-mips.c,v
retrieving revision 1.46
diff -u -p -r1.46 elfxx-mips.c
--- bfd/elfxx-mips.c 12 Mar 2003 23:05:51 -0000 1.46
+++ bfd/elfxx-mips.c 23 Mar 2003 23:28:15 -0000
@@ -8905,11 +8905,24 @@ _bfd_mips_elf_merge_private_bfd_data (ib
 
   /* Check if we have the same endianess */
   if (! _bfd_generic_verify_endian_match (ibfd, obfd))
-    return FALSE;
+    {
+      (*_bfd_error_handler)
+	(_("%s: endianness incompatible with that of the selected emulation"),
+	 bfd_archive_filename (ibfd));
+      return FALSE;
+    }
 
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
     return TRUE;
+
+  if (strcmp (bfd_get_target (ibfd), bfd_get_target (obfd)) != 0)
+    {
+      (*_bfd_error_handler)
+	(_("%s: ABI is incompatible with that of the select emulation"),
+	 bfd_archive_filename (ibfd));
+      return FALSE;
+    }
 
   new_flags = elf_elfheader (ibfd)->e_flags;
   elf_elfheader (obfd)->e_flags |= new_flags & EF_MIPS_NOREORDER;

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

             reply	other threads:[~2003-03-24  0:16 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-24  7:41 Alexandre Oliva [this message]
2003-03-24  7:58 ` Thiemo Seufer
2003-03-28 18:51   ` Alexandre Oliva
2003-05-04 21:25     ` Alexandre Oliva
2003-05-04 21:33       ` Thiemo Seufer
2003-05-05  5:55       ` Eric Christopher
2003-05-07  4:12     ` Alexandre Oliva
2003-05-07  4:34       ` Eric Christopher
     [not found]       ` <mailpost.1052280762.26483@news-sj1-1>
2003-05-07  5:03         ` cgd
2003-05-07  5:07           ` Alexandre Oliva
2003-05-07  5:09             ` Eric Christopher
     [not found]             ` <mailpost.1052284059.27953@news-sj1-1>
2003-05-07  5:09               ` cgd
2003-05-07  5:17                 ` Alexandre Oliva
2003-05-07  5:28                   ` Eric Christopher
2003-05-07  5:51                     ` Alexandre Oliva
2003-05-07  5:59                       ` Eric Christopher
2003-05-07  5:27           ` Alexandre Oliva
2003-05-07  6:39       ` Richard Sandiford
2003-05-07 15:38         ` Alexandre Oliva
2003-05-07 15:57           ` Richard Sandiford
2003-05-07 16:43             ` Eric Christopher
2003-05-07 17:04               ` Richard Sandiford
2003-05-07 17:07                 ` Eric Christopher
2003-05-08 16:57                   ` Alexandre Oliva
     [not found]                     ` <mailpost.1052413109.28553@news-sj1-1>
2003-05-08 17:54                       ` cgd
2003-05-08 18:19                         ` Alexandre Oliva
2003-05-08 18:30                           ` cgd
2003-05-08 22:22                             ` Eric Christopher
2003-05-08 18:43                           ` Thiemo Seufer
2003-05-15  0:22                     ` Alexandre Oliva
2003-05-15  0:39                       ` Eric Christopher
2003-05-15  1:59                         ` Alexandre Oliva
2003-05-15  2:14                           ` Eric Christopher
     [not found]                 ` <mailpost.1052327094.17221@news-sj1-1>
2003-05-08  0:36                   ` cgd
2003-05-07 16:17           ` Thiemo Seufer
2003-05-20 20:40       ` Maciej W. Rozycki
2003-05-20 20:55         ` Thiemo Seufer
2003-05-20 21:00         ` Eric Christopher
2003-05-20 21:07           ` Maciej W. Rozycki
2003-05-20 21:19             ` Eric Christopher
2003-05-20 22:42               ` Alexandre Oliva
2003-05-20 22:49                 ` Eric Christopher
2003-05-21 10:48                 ` Maciej W. Rozycki
     [not found]             ` <mailpost.1053464869.12015@news-sj1-1>
2003-05-20 22:06               ` cgd
2003-05-21 11:06                 ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=orsmtdty9d.fsf@free.redhat.lsd.ic.unicamp.br \
    --to=aoliva@redhat.com \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).