Merge MIPS dl-lookup.c into generic file.

MIPS has its own version of dl-lookup.c to deal with differences
between undefined symbol semantics in the PIC and non-PIC ABIs.  This
is often liable to get out of date with respect to the generic file
(for example, the recent __builtin_expect changes didn't cover ports,
and it's not obvious to anyone changing dl-lookup.c that there would
be architecture-specific versions).

This patch adds a macro that dl-machine.h can define that is used in
the appropriate place in dl-lookup.c, so that MIPS no longer needs its
own version of that file.

Tested for mips64 that the only changes to disassembly of installed
shared libraries appear to be ld.so changes attributable to different
line numbers and paths in assertions.

	* elf/dl-lookup.c (ELF_MACHINE_SYM_NO_MATCH): Define if not
	already defined.
	(do_lookup_x): Use ELF_MACHINE_SYM_NO_MATCH.
	* sysdeps/mips/dl-lookup.c: Remove.
	* sysdeps/mips/dl-machine.h (ELF_MACHINE_SYM_NO_MATCH): New macro.
This commit is contained in:
Joseph Myers 2014-02-11 22:33:07 +00:00
parent 7e6424e343
commit cb4a292812
4 changed files with 31 additions and 1029 deletions

View File

@ -1,3 +1,11 @@
2014-02-11 Joseph Myers <joseph@codesourcery.com>
* elf/dl-lookup.c (ELF_MACHINE_SYM_NO_MATCH): Define if not
already defined.
(do_lookup_x): Use ELF_MACHINE_SYM_NO_MATCH.
* sysdeps/mips/dl-lookup.c: Remove.
* sysdeps/mips/dl-machine.h (ELF_MACHINE_SYM_NO_MATCH): New macro.
2014-02-11 Stefan Liebler <stli@linux.vnet.ibm.com>
[BZ #16447]

View File

@ -31,6 +31,13 @@
#include <assert.h>
/* Return nonzero if do_lookup_x:check_match should consider SYM to
fail to match a symbol reference for some machine-specific
reason. */
#ifndef ELF_MACHINE_SYM_NO_MATCH
# define ELF_MACHINE_SYM_NO_MATCH(sym) 0
#endif
#define VERSTAG(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (tag))
/* We need this string more than once. */
@ -133,6 +140,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
assert (ELF_RTYPE_CLASS_PLT == 1);
if (__builtin_expect ((sym->st_value == 0 /* No value. */
&& stt != STT_TLS)
|| ELF_MACHINE_SYM_NO_MATCH (sym)
|| (type_class & (sym->st_shndx == SHN_UNDEF)),
0))
return NULL;

File diff suppressed because it is too large Load Diff

View File

@ -439,6 +439,21 @@ elf_machine_plt_value (struct link_map *map, const ElfW(Rel) *reloc,
return value;
}
/* The semantics of zero/non-zero values of undefined symbols differs
depending on whether the non-PIC ABI is in use. Under the non-PIC
ABI, a non-zero value indicates that there is an address reference
to the symbol and thus it must always be resolved (except when
resolving a jump slot relocation) to the PLT entry whose address is
provided as the symbol's value; a zero value indicates that this
canonical-address behaviour is not required. Yet under the classic
MIPS psABI, a zero value indicates that there is an address
reference to the function and the dynamic linker must resolve the
symbol immediately upon loading. To avoid conflict, symbols for
which the dynamic linker must assume the non-PIC ABI semantics are
marked with the STO_MIPS_PLT flag. */
#define ELF_MACHINE_SYM_NO_MATCH(sym) \
((sym)->st_shndx == SHN_UNDEF && !((sym)->st_other & STO_MIPS_PLT))
#endif /* !dl_machine_h */
#ifdef RESOLVE_MAP