Skip to content

Commit

Permalink
Protect against multiple inclusion.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaeger committed Mar 28, 2005
1 parent f850220 commit 78bf97c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
9 changes: 7 additions & 2 deletions sysdeps/mips/bits/setjmp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Define the machine-dependent type `jmp_buf'. MIPS version.
Copyright (C) 1992, 1993, 1995, 1997, 2000, 2002, 2003, 2004
Copyright (C) 1992, 1993, 1995, 1997, 2000, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand All @@ -18,7 +18,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#ifndef _SETJMP_H
#ifndef _MIPS_BITS_SETJMP_H
#define _MIPS_BITS_SETJMP_H 1

#if !defined(_SETJMP_H) && !defined(_PTHREAD_H)
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif

Expand Down Expand Up @@ -79,3 +82,5 @@ typedef struct
containing a local variable at ADDRESS. */
#define _JMPBUF_UNWINDS(jmpbuf, address) \
((void *) (address) < (jmpbuf)[0].__sp)

#endif /* _MIPS_BITS_SETJMP_H */
45 changes: 44 additions & 1 deletion sysdeps/mips/dl-machine.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Machine-dependent ELF dynamic relocation inline functions. MIPS version.
Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 1996-2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
Expand Down Expand Up @@ -34,6 +35,7 @@

#include <sgidefs.h>
#include <sys/asm.h>
#include <dl-tls.h>

/* The offset of gp from GOT might be system-dependent. It's set by
ld. The same value is also */
Expand Down Expand Up @@ -322,6 +324,47 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,

switch (r_type)
{
#if defined (USE_TLS) && !defined (RTLD_BOOTSTRAP)
# if _MIPS_SIM == _ABI64
case R_MIPS_TLS_DTPMOD64:
case R_MIPS_TLS_DTPREL64:
case R_MIPS_TLS_TPREL64:
# else
case R_MIPS_TLS_DTPMOD32:
case R_MIPS_TLS_DTPREL32:
case R_MIPS_TLS_TPREL32:
# endif
{
struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;

if (sym)
value += sym->st_value;

switch (r_type)
{
case R_MIPS_TLS_DTPMOD64:
case R_MIPS_TLS_DTPMOD32:
if (sym_map)
*(ElfW(Word) *)reloc_addr = sym_map->l_tls_modid;
break;

case R_MIPS_TLS_DTPREL64:
case R_MIPS_TLS_DTPREL32:
*(ElfW(Word) *)reloc_addr += TLS_DTPREL_VALUE (sym);
break;

case R_MIPS_TLS_TPREL32:
case R_MIPS_TLS_TPREL64:
CHECK_STATIC_TLS (map, sym_map);
*(ElfW(Word) *)reloc_addr += TLS_TPREL_VALUE (sym_map, sym);
break;
}

break;
}
#endif

#if _MIPS_SIM == _ABI64
case (R_MIPS_64 << 8) | R_MIPS_REL32:
#else
Expand Down

0 comments on commit 78bf97c

Please sign in to comment.