Commit graph

8 commits

Author SHA1 Message Date
Alan Modra 0572433b5b PowerPC64 ELFv2 PPC64_OPT_LOCALENTRY
ELFv2 functions with localentry:0 are those with a single entry point,
ie. global entry == local entry, that have no requirement on r2 or
r12 and guarantee r2 is unchanged on return.  Such an external
function can be called via the PLT without saving r2 or restoring it
on return, avoiding a common load-hit-store for small functions.

This patch implements the ld.so changes necessary for this
optimization.  ld.so needs to check that an optimized plt call
sequence is in fact calling a function implemented with localentry:0,
end emit a fatal error otherwise.

The elf/testobj6.c change is to stop "error while loading shared
libraries: expected localentry:0 `preload'" when running
elf/preloadtest, which we'd get otherwise.

	* elf/elf.h (PPC64_OPT_LOCALENTRY): Define.
	* sysdeps/alpha/dl-machine.h (elf_machine_fixup_plt): Add
	refsym and sym parameters.  Adjust callers.
	* sysdeps/aarch64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/arm/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/generic/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/i386/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/ia64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/m68k/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/microblaze/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/mips/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/nios2/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_fixup_plt):
	Likewise.
	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/s390/s390-64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/sh/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/tile/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/x86_64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/powerpc/powerpc64/dl-machine.c (_dl_error_localentry): New.
	(_dl_reloc_overflow): Increase buffser size.  Formatting.
	* sysdeps/powerpc/powerpc64/dl-machine.h (ppc64_local_entry_offset):
	Delete reloc param, add refsym and sym.  Check optimized plt
	call stubs for localentry:0 functions.  Adjust callers.
	(elf_machine_fixup_plt, elf_machine_plt_conflict): Add refsym
	and sym parameters.  Adjust callers.
	(_dl_reloc_overflow): Move attribute.
	(_dl_error_localentry): Declare.
	* elf/dl-runtime.c (_dl_fixup): Save original sym.  Pass
	refsym and sym to elf_machine_fixup_plt.
	* elf/testobj6.c (preload): Call printf.
2017-06-14 10:47:25 +09:30
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
H.J. Lu 209826bcf2 Replace ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY
ELF_RTYPE_CLASS_NOCOPY in comments is a typo.  It should be
ELF_RTYPE_CLASS_COPY.

	[BZ #18082]
	* sysdeps/alpha/dl-machine.h (elf_machine_type_class): Replace
	ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY in comments.
	* sysdeps/arm/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/i386/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/ia64/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/m68k/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/microblaze/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/nios2/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/s390/s390-64/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/sh/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/tile/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/x86_64/dl-machine.h (elf_machine_type_class): Likewise.
2015-03-05 08:40:41 -08:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Joseph Myers c5684fdb2b Don't use INTDEF/INTUSE with _dl_init (bug 14132).
Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch eliminates its use for _dl_init.  Since _dl_init was already
declared with hidden visibility, creating a second hidden alias for it
was completely pointless, so this patch replaces all uses of
_dl_init_internal with plain _dl_init instead of using hidden_proto /
hidden_def (which are only needed when you want a hidden alias for a
non-hidden symbol; it's quite possible there are cases where they are
used but don't need to be because the symbol in question is not part
of the public ABI and is only used within a single library, so using
attributes_hidden instead would suffice).

Tested for x86_64 that installed stripped shared libraries are
unchanged by the patch.

	[BZ #14132]
	* elf/dl-init.c (_dl_init): Don't use INTDEF.
	* sysdeps/aarch64/dl-machine.h (RTLD_START): Use _dl_init instead
	of _dl_init_internal.
	* sysdeps/alpha/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/arm/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/hppa/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/i386/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/ia64/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/m68k/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/microblaze/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/mips/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/powerpc/powerpc32/dl-start.S (_start): Likewise.
	* sysdeps/s390/s390-32/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/s390/s390-64/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/sh/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/tile/dl-start.S (_start): Likewise.
	* sysdeps/x86_64/dl-machine.h (RTLD_START): Likewise.
	* sysdeps/x86_64/x32/dl-machine.h (RTLD_START): Likewise.
2014-11-04 23:26:39 +00:00
Siddhesh Poyarekar 4cf5b6d0d7 Fix Wundef warning for ELF_MACHINE_NO_RELA
This patch defines ELF_MACHINE_NO_RELA on all architectures.  Tested
only on x86_64 to verify that the sources before and after are
identical except for two instructions that pass the current line
number in dl-machine.h to assert_fail.
2014-06-26 22:30:40 +05:30
David Holsgrove ef114eafbf [MicroBlaze]: Move MicroBlaze from ports to sysdeps.
2014-02-17  David Holsgrove <david.holsgrove@xilinx.com>

        * sysdeps/microblaze: Move directory from ports/sysdeps/microblaze.
        * sysdeps/unix/sysv/linux/microblaze: Move directory from
          ports/sysdeps/unix/sysv/linux/microblaze.
        * README: Add missing listing for microblaze*-*-linux-gnu.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2014-02-17 11:08:21 +10:00
Renamed from ports/sysdeps/microblaze/dl-machine.h (Browse further)