Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Sep 2010 15:12:18 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r213104 - head/sys/sparc64/sparc64
Message-ID:  <201009241512.o8OFCIHG029260@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Fri Sep 24 15:12:18 2010
New Revision: 213104
URL: http://svn.freebsd.org/changeset/base/213104

Log:
  minor simplifications and cosmetics

Modified:
  head/sys/sparc64/sparc64/elf_machdep.c

Modified: head/sys/sparc64/sparc64/elf_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/elf_machdep.c	Fri Sep 24 15:01:45 2010	(r213103)
+++ head/sys/sparc64/sparc64/elf_machdep.c	Fri Sep 24 15:12:18 2010	(r213104)
@@ -132,8 +132,8 @@ void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
     size_t *off __unused)
 {
-}
 
+}
 
 /*
  * The following table holds for each relocation type:
@@ -219,7 +219,7 @@ static const int reloc_target_flags[] = 
 };
 
 #if 0
-static const char *reloc_names[] = {
+static const char *const reloc_names[] = {
 	"NONE", "RELOC_8", "RELOC_16", "RELOC_32", "DISP_8",
 	"DISP_16", "DISP_32", "WDISP_30", "WDISP_22", "HI22",
 	"22", "13", "LO10", "GOT10", "GOT13",
@@ -275,10 +275,9 @@ static const long reloc_target_bitmask[]
 
 int
 elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
-    int type, elf_lookup_fn lookup)
+    int type, elf_lookup_fn lookup __unused)
 {
 	const Elf_Rela *rela;
-	Elf_Addr value;
 	Elf_Addr *where;
 
 	if (type != ELF_RELOC_RELA)
@@ -288,10 +287,8 @@ elf_reloc_local(linker_file_t lf, Elf_Ad
 	if (ELF64_R_TYPE_ID(rela->r_info) != R_SPARC_RELATIVE)
 		return (-1);
 
-	value = rela->r_addend + (Elf_Addr)lf->address;
-	where = (Elf_Addr *)((Elf_Addr)lf->address + rela->r_offset);
-
-	*where = elf_relocaddr(lf, value);
+	where = (Elf_Addr *)(relocbase + rela->r_offset);
+	*where = elf_relocaddr(lf, rela->r_addend + relocbase);
 
 	return (0);
 }
@@ -346,9 +343,8 @@ elf_reloc(linker_file_t lf, Elf_Addr rel
 	if (RELOC_PC_RELATIVE(rtype))
 		value -= (Elf_Addr)where;
 
-	if (RELOC_BASE_RELATIVE(rtype)) {
+	if (RELOC_BASE_RELATIVE(rtype))
 		value = elf_relocaddr(lf, value + relocbase);
-	}
 
 	mask = RELOC_VALUE_BITMASK(rtype);
 	value >>= RELOC_VALUE_RIGHTSHIFT(rtype);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009241512.o8OFCIHG029260>