Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2003 14:14:56 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 31729 for review
Message-ID:  <200305232114.h4NLEu0t089778@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=31729

Change 31729 by peter@peter_hammer on 2003/05/23 14:14:14

	make this compile and link.  There is a long way to go still.

Affected files ...

.. //depot/projects/hammer/libexec/rtld-elf/amd64/reloc.c#5 edit

Differences ...

==== //depot/projects/hammer/libexec/rtld-elf/amd64/reloc.c#5 (text+ko) ====

@@ -48,7 +48,7 @@
 #include "rtld.h"
 
 /*
- * Process the special R_386_COPY relocations in the main program.  These
+ * Process the special R_X86_64_COPY relocations in the main program.  These
  * copy data from a shared object into a region in the main program's BSS
  * segment.
  *
@@ -64,7 +64,7 @@
 
     rellim = (const Elf_Rel *) ((caddr_t) dstobj->rel + dstobj->relsize);
     for (rel = dstobj->rel;  rel < rellim;  rel++) {
-	if (ELF_R_TYPE(rel->r_info) == R_386_COPY) {
+	if (ELF_R_TYPE(rel->r_info) == R_X86_64_COPY) {
 	    void *dstaddr;
 	    const Elf_Sym *dstsym;
 	    const char *name;
@@ -132,10 +132,10 @@
 
 	    switch (ELF_R_TYPE(rel->r_info)) {
 
-	    case R_386_NONE:
+	    case R_X86_64_NONE:
 		break;
 
-	    case R_386_32:
+	    case R_X86_64_64:
 		{
 		    const Elf_Sym *def;
 		    const Obj_Entry *defobj;
@@ -149,7 +149,7 @@
 		}
 		break;
 
-	    case R_386_PC32:
+	    case R_X86_64_PC32:
 		/*
 		 * I don't think the dynamic linker should ever see this
 		 * type of relocation.  But the binutils-2.6 tools sometimes
@@ -169,8 +169,9 @@
 		      (Elf_Addr) where;
 		}
 		break;
+	/* missing: R_X86_64_GOT32 R_X86_64_PLT32 */
 
-	    case R_386_COPY:
+	    case R_X86_64_COPY:
 		/*
 		 * These are deferred until all other relocations have
 		 * been done.  All we do here is make sure that the COPY
@@ -178,13 +179,13 @@
 		 * only in executable files.
 		 */
 		if (!obj->mainprog) {
-		    _rtld_error("%s: Unexpected R_386_COPY relocation"
+		    _rtld_error("%s: Unexpected R_X86_64_COPY relocation"
 		      " in shared library", obj->path);
 		    goto done;
 		}
 		break;
 
-	    case R_386_GLOB_DAT:
+	    case R_X86_64_GLOB_DAT:
 		{
 		    const Elf_Sym *def;
 		    const Obj_Entry *defobj;
@@ -198,10 +199,12 @@
 		}
 		break;
 
-	    case R_386_RELATIVE:
+	    case R_X86_64_RELATIVE:
 		*where += (Elf_Addr) obj->relocbase;
 		break;
 
+	/* missing: R_X86_64_GOTPCREL, R_X86_64_32, R_X86_64_32S, R_X86_64_16, R_X86_64_PC16, R_X86_64_8, R_X86_64_PC8 */
+
 	    default:
 		_rtld_error("%s: Unsupported relocation type %d"
 		  " in non-PLT relocations\n", obj->path,
@@ -227,7 +230,7 @@
     for (rel = obj->pltrel;  rel < rellim;  rel++) {
 	Elf_Addr *where;
 
-	assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT);
+	assert(ELF_R_TYPE(rel->r_info) == R_X86_64_JMP_SLOT);
 
 	/* Relocate the GOT slot pointing into the PLT. */
 	where = (Elf_Addr *)(obj->relocbase + rel->r_offset);
@@ -251,7 +254,7 @@
 	const Elf_Sym *def;
 	const Obj_Entry *defobj;
 
-	assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT);
+	assert(ELF_R_TYPE(rel->r_info) == R_X86_64_JMP_SLOT);
 	where = (Elf_Addr *)(obj->relocbase + rel->r_offset);
 	def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL);
 	if (def == NULL)



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