linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SH FDPIC ABI spec/binutils and kernel conflict on flag definitions
@ 2015-09-10  3:34 Rich Felker
  2015-09-10 11:57 ` Nick Clifton
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Rich Felker @ 2015-09-10  3:34 UTC (permalink / raw)
  To: linux-sh

In the ELF Header part of the SH FDPIC ABI document, it's stated that
EF_SH_FDPIC|EF_SH_PIC means each LOAD segment can be independently
positioned, while EF_SH_FDPIC by itself (without EF_SH_PIC) means the
relative position of LOAD segments with respect to each other is fixed
(like in normal ELF usage). This seems to match what binutils outputs.

However the kernel contains the code (arch/sh/include/asm/elf.h):

#define elf_check_const_displacement(x) ((x)->e_flags & EF_SH_PIC)

and (fs/binfmt_elf_fdpic.c):

	if (elf_check_const_displacement(&exec_params.hdr))
		exec_params.flags |= ELF_FDPIC_FLAG_CONSTDISP;

which does exactly the opposite: the presence of the EF_SH_PIC flag,
rather than absence of it, causes the kernel to treat the binary as
one requiring "constant displacement" between LOAD segments.

If my analysis is correct, how should this be fixed? It seems to me
the kernel is clearly wrong, but it might also be considered the de
facto ABI. Is there any way forward that allows fixing this bug (which
defeats the whole purpose of FDPIC) without breaking existing usage?
Or is there no existing usage to care about?

Rich

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-12-30  3:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-10  3:34 SH FDPIC ABI spec/binutils and kernel conflict on flag definitions Rich Felker
2015-09-10 11:57 ` Nick Clifton
2015-09-10 14:58 ` Rich Felker
2015-09-10 15:45 ` David Howells
2015-09-10 15:50 ` Rich Felker
2015-09-10 15:53 ` David Howells
2015-09-10 16:01 ` Rich Felker
2015-09-10 21:09 ` Rich Felker
2015-09-14 16:09 ` Rich Felker
2015-12-30  3:55 ` Mike Frysinger

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 NNTP newsgroup(s).