This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: PATCH: Fix prelink for mips
On Thu, Jan 17, 2002 at 03:11:28PM -0800, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@lucon.org> writes:
>
> > Some patch is necessary since mips doesn't have elf_machine_rela. You
> > can define a dummy elf_machine_rela in sysdeps/mips/dl-machine.h. But
> > ...
>
> Then make the use of the type (or all of prelinking) depending on
> this. If a new architecture is added it'll have the same problem.
> Define _DL_HAVE_NO_ELF_MACHINE_RELA or and test for it in dl-conflict.
>
Here is the new patch. I also changed mips to use __attribute_used__.
H.J.
---
2002-01-18 H.J. Lu <hjl@gnu.org>
* elf/dl-conflict.c (_dl_resolve_conflicts): Dummy if
_DL_HAVE_NO_ELF_MACHINE_RELA is defined.
* sysdeps/mips/dl-machine.h (_DL_HAVE_NO_ELF_MACHINE_RELA):
Defined.
(elf_machine_matches_host): Use __attribute_used__.
(__dl_runtime_resolve): Likewise.
* sysdeps/mips/machine-gmon.h (_MCOUNT_DECL): Make it a real
declaration.
--- libc/elf/dl-conflict.c.mips Mon Dec 31 09:33:22 2001
+++ libc/elf/dl-conflict.c Thu Jan 17 23:02:30 2002
@@ -31,9 +31,11 @@
extern unsigned long int _dl_num_cache_relocations; /* in dl-lookup.c */
void
-_dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
- ElfW(Rela) *conflictend)
+_dl_resolve_conflicts (struct link_map *l __attribute__ ((unused)),
+ ElfW(Rela) *conflict __attribute__ ((unused)),
+ ElfW(Rela) *conflictend __attribute__ ((unused)))
{
+#ifndef _DL_HAVE_NO_ELF_MACHINE_RELA
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_RELOC, 0))
_dl_printf ("\nconflict processing: %s\n",
l->l_name[0] ? l->l_name : _dl_argv[0]);
@@ -68,4 +70,5 @@ do \
for (; conflict < conflictend; ++conflict)
elf_machine_rela (l, conflict, NULL, NULL, (void *) conflict->r_offset);
}
+#endif
}
--- libc/sysdeps/mips/dl-machine.h.mips Thu Jan 17 14:05:57 2002
+++ libc/sysdeps/mips/dl-machine.h Thu Jan 17 23:13:11 2002
@@ -56,6 +56,9 @@
#define ELF_MACHINE_JMP_SLOT R_MIPS_REL32
#define elf_machine_type_class(type) ELF_RTYPE_CLASS_PLT
+/* MIPS doesn't support RELA. */
+#define _DL_HAVE_NO_ELF_MACHINE_RELA
+
/* Translate a processor specific dynamic tag to the index
in l_info array. */
#define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM)
@@ -69,7 +72,7 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)])
} while (0)
/* Return nonzero iff ELF header is compatible with the running host. */
-static inline int __attribute__ ((unused))
+static inline int __attribute_used__
elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
{
switch (ehdr->e_machine)
@@ -263,7 +266,7 @@ int _dl_mips_gnu_objects = 1;
/* This is called from assembly stubs below which the compiler can't see. */ \
static ElfW(Addr) \
__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr)) \
- __attribute__ ((unused)); \
+ __attribute_used__; \
\
static ElfW(Addr) \
__dl_runtime_resolve (ElfW(Word) sym_index, \
--- libc/sysdeps/mips/machine-gmon.h.mips Thu Jan 17 11:48:51 2002
+++ libc/sysdeps/mips/machine-gmon.h Thu Jan 17 23:43:05 2002
@@ -17,7 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _MCOUNT_DECL static void __mcount
+#define _MCOUNT_DECL(frompc,selfpc) \
+static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
/* Call __mcount with our the return PC for our caller,
and the return PC our caller will return to. */