This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: SH FDPIC ABI spec/binutils and kernel conflict on flag definitions
- From: Rich Felker <dalias at libc dot org>
- To: David Howells <dhowells at redhat dot com>
- Cc: Nick Clifton <nickc at redhat dot com>, linux-sh at vger dot kernel dot org, binutils at sourceware dot org, Oleg Endo <oleg dot endo at t-online dot de>, Steven Miao <realmz6 at gmail dot com>
- Date: Mon, 14 Sep 2015 12:09:56 -0400
- Subject: Re: SH FDPIC ABI spec/binutils and kernel conflict on flag definitions
- Authentication-results: sourceware.org; auth=none
- References: <20150910155059 dot GO17773 at brightrain dot aerifal dot cx> <20150910145808 dot GN17773 at brightrain dot aerifal dot cx> <20150910033400 dot GM17773 at brightrain dot aerifal dot cx> <55F17015 dot 8090207 at redhat dot com> <23476 dot 1441899930 at warthog dot procyon dot org dot uk> <23551 dot 1441900415 at warthog dot procyon dot org dot uk>
On Thu, Sep 10, 2015 at 04:53:35PM +0100, David Howells wrote:
> Rich Felker <dalias@libc.org> wrote:
>
> > On the other hand, the only existing way to produce a binary that both
> > (1) needs constant displacement, and (2) actually gets constant
> > displacement from the kernel at load time, is to manually edit the ELF
> > headers to flip the bit. So I really doubt any such binaries exist. Do
> > you have a reason to believe they do?
>
> Well, Fujitsu asked for it for FRV - I've no idea whether they have such
> binaries still.
OK, I've solved part of the mystery: on FRV and Blackfin, binutils
matches the kernel behavior and conflicts with the (effectively wrong)
ABI documents. As can be seen at the following locations in the
source, EF_$ARCH_PIC is cleared by default and set when there is a
cross-segment relocation that forces constant displacement:
Blackfin:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-bfin.c;h=152134ee7b9b445d96818fcab2350ffd11795897;hb=HEAD#l3140
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-bfin.c;h=152134ee7b9b445d96818fcab2350ffd11795897;hb=HEAD#l4978
FRV:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-frv.c;h=fa12528b3d11ab9ed7a4d5d894f8b9c1a5e783a9;hb=HEAD#l3919
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-frv.c;h=fa12528b3d11ab9ed7a4d5d894f8b9c1a5e783a9;hb=HEAD#l6367
And SH does the opposite:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-sh.c;h=7b8d7636de5fe4ce169eacbeb876ab7d741df798;hb=HEAD#l5499
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-sh.c;h=7b8d7636de5fe4ce169eacbeb876ab7d741df798;hb=HEAD#l6656
So I think for consistency with other FDPIC targets, and to avoid
changing kernel ABI, binutils should just be fixed to match the
Blackfin and FRV interpretation of EF_$ARCH_PIC on SH as well.
Ideally fixed versions of the ABI documents should also be produced.
Rich