* sysdeps/i386/dl-machine.h (elf_machine_rela): Handle R_386_COPY.

* sysdeps/arm/dl-machine.h (elf_machine_rela): Handle R_ARM_COPY.

2002-11-15  Roland McGrath  <roland@redhat.com>

	* math/Makefile (libm-calls): Change s_ldexp to m_ldexp.
	* Makerules ($(+sysdir_pfx)sysd-rules): Emit pattern rules for m_%.[Sc]
	from sysdeps/.../s_%.[Sc] with commands $(+make-include-of-dep).
	(+make-include-of-dep): New canned sequence.

	* stdlib/canonicalize.c (__realpath): Check for malloc failure.
	From Dmitry V. Levin <ldv@altlinux.org>.
This commit is contained in:
Roland McGrath 2002-11-15 22:51:30 +00:00
parent 53da80ab88
commit 92712dee68
6 changed files with 85 additions and 2 deletions

View File

@ -1,3 +1,18 @@
2002-11-15 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/dl-machine.h (elf_machine_rela): Handle R_386_COPY.
* sysdeps/arm/dl-machine.h (elf_machine_rela): Handle R_ARM_COPY.
2002-11-15 Roland McGrath <roland@redhat.com>
* math/Makefile (libm-calls): Change s_ldexp to m_ldexp.
* Makerules ($(+sysdir_pfx)sysd-rules): Emit pattern rules for m_%.[Sc]
from sysdeps/.../s_%.[Sc] with commands $(+make-include-of-dep).
(+make-include-of-dep): New canned sequence.
* stdlib/canonicalize.c (__realpath): Check for malloc failure.
From Dmitry V. Levin <ldv@altlinux.org>.
2002-11-14 Roland McGrath <roland@redhat.com> 2002-11-14 Roland McGrath <roland@redhat.com>
* sysdeps/generic/errno.c (__libc_errno): Remove alias. * sysdeps/generic/errno.c (__libc_errno): Remove alias.

View File

@ -283,6 +283,8 @@ $(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
\$$(+make-deps)"; \ \$$(+make-deps)"; \
echo "\$$(objpfx)rtld-%.d: $$dir/%.c \$$(before-compile); \ echo "\$$(objpfx)rtld-%.d: $$dir/%.c \$$(before-compile); \
\$$(+make-deps)"; \ \$$(+make-deps)"; \
echo "\$$(objpfx)m_%.S: $$dir/s_%.S; \$$(+make-include-of-dep)"; \
echo "\$$(objpfx)m_%.c: $$dir/s_%.c; \$$(+make-include-of-dep)"; \
done; \ done; \
echo 'sysd-rules-done = t') > $@T echo 'sysd-rules-done = t') > $@T
mv -f $@T $@ mv -f $@T $@
@ -292,6 +294,12 @@ ifndef sysd-rules-done
no_deps=t no_deps=t
endif endif
# This is used by the m_%.[Sc] pattern rules in sysd-rules.
define +make-include-of-dep
echo '#include <$<>' > $@T
mv -f $@T $@
endef
# Generate version maps, but wait until sysdep-subdirs is known # Generate version maps, but wait until sysdep-subdirs is known
ifeq ($(sysd-sorted-done),t) ifeq ($(sysd-sorted-done),t)
ifeq ($(versioning),yes) ifeq ($(versioning),yes)

View File

@ -46,7 +46,7 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \
e_rem_pio2 e_remainder e_scalb e_sinh e_sqrt e_gamma_r \ e_rem_pio2 e_remainder e_scalb e_sinh e_sqrt e_gamma_r \
k_cos k_rem_pio2 k_sin k_tan s_asinh s_atan s_cbrt \ k_cos k_rem_pio2 k_sin k_tan s_asinh s_atan s_cbrt \
s_ceil s_copysign s_cos s_erf s_expm1 s_fabs s_finite \ s_ceil s_copysign s_cos s_erf s_expm1 s_fabs s_finite \
s_floor s_frexp s_ilogb s_ldexp s_log1p s_logb \ s_floor s_frexp s_ilogb m_ldexp s_log1p s_logb \
s_modf s_nextafter s_nexttoward s_rint s_scalbn s_scalbln \ s_modf s_nextafter s_nexttoward s_rint s_scalbn s_scalbln \
s_significand s_sin s_tan s_tanh w_acos w_acosh w_asin \ s_significand s_sin s_tan s_tanh w_acos w_acosh w_asin \
w_atan2 w_atanh w_cosh w_drem w_exp w_exp2 w_exp10 w_fmod \ w_atan2 w_atanh w_cosh w_drem w_exp w_exp2 w_exp10 w_fmod \
@ -74,6 +74,8 @@ distribute += $(long-m-yes:=.c)
# These functions are in libc instead of libm because __printf_fp # These functions are in libc instead of libm because __printf_fp
# calls them, so any program using printf will need them linked in, # calls them, so any program using printf will need them linked in,
# and we don't want to have to link every program with -lm. # and we don't want to have to link every program with -lm.
# In libm-calls (above), list m_foo in place of s_foo for any
# routine that should be compiled separately for its libc and libm versions.
calls = s_isinf s_isnan s_finite s_copysign s_modf s_scalbn s_frexp s_ldexp \ calls = s_isinf s_isnan s_finite s_copysign s_modf s_scalbn s_frexp s_ldexp \
s_signbit s_signbit
routines = $(calls) $(calls:=f) $(long-c-$(long-double-fcts)) routines = $(calls) $(calls:=f) $(long-c-$(long-double-fcts))

View File

@ -73,7 +73,14 @@ __realpath (const char *name, char *resolved)
path_max = 1024; path_max = 1024;
#endif #endif
rpath = resolved ? __alloca (path_max) : malloc (path_max); if (resolved == NULL)
{
rpath = malloc (path_max);
if (rpath == NULL)
return NULL;
}
else
rpath = resolved;
rpath_limit = rpath + path_max; rpath_limit = rpath + path_max;
if (name[0] != '/') if (name[0] != '/')

View File

@ -554,12 +554,37 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
return; return;
else else
{ {
# ifndef RESOLVE_CONFLICT_FIND_MAP
const Elf32_Sym *const refsym = sym;
# endif
Elf32_Addr value = RESOLVE (&sym, version, r_type); Elf32_Addr value = RESOLVE (&sym, version, r_type);
if (sym) if (sym)
value += sym->st_value; value += sym->st_value;
switch (r_type) switch (r_type)
{ {
# ifndef RESOLVE_CONFLICT_FIND_MAP
/* Not needed for dl-conflict.c. */
case R_ARM_COPY:
if (sym == NULL)
/* This can happen in trace mode if an object could not be
found. */
break;
if (sym->st_size > refsym->st_size
|| (GL(dl_verbose) && sym->st_size < refsym->st_size))
{
const char *strtab;
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
rtld_progname ?: "<program name unknown>",
strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
refsym->st_size));
break;
# endif /* !RESOLVE_CONFLICT_FIND_MAP */
case R_ARM_GLOB_DAT: case R_ARM_GLOB_DAT:
case R_ARM_JUMP_SLOT: case R_ARM_JUMP_SLOT:
case R_ARM_ABS32: case R_ARM_ABS32:

View File

@ -514,6 +514,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
*reloc_addr = map->l_addr + reloc->r_addend; *reloc_addr = map->l_addr + reloc->r_addend;
else if (r_type != R_386_NONE) else if (r_type != R_386_NONE)
{ {
# ifndef RESOLVE_CONFLICT_FIND_MAP
const Elf32_Sym *const refsym = sym;
# endif
# ifdef USE_TLS # ifdef USE_TLS
struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
@ -568,6 +571,29 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
CHECK_STATIC_TLS (map, sym_map); CHECK_STATIC_TLS (map, sym_map);
break; break;
# endif /* use TLS */ # endif /* use TLS */
# ifndef RESOLVE_CONFLICT_FIND_MAP
/* Not needed for dl-conflict.c. */
case R_386_COPY:
if (sym == NULL)
/* This can happen in trace mode if an object could not be
found. */
break;
if (__builtin_expect (sym->st_size > refsym->st_size, 0)
|| (__builtin_expect (sym->st_size < refsym->st_size, 0)
&& GL(dl_verbose)))
{
const char *strtab;
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
_dl_error_printf ("\
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
rtld_progname ?: "<program name unknown>",
strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
refsym->st_size));
break;
# endif /* !RESOLVE_CONFLICT_FIND_MAP */
default: default:
/* We add these checks in the version to relocate ld.so only /* We add these checks in the version to relocate ld.so only
if we are still debugging. */ if we are still debugging. */