Subject: Re: R_68K_32 relocation with addend on ld.elf_so
To: ITOH Yasufumi <itohy@netbsd.org>
From: Klaus Klein <kleink@ira.uka.de>
List: tech-toolchain
Date: 10/19/1999 15:03:15
itohy@netbsd.org (ITOH Yasufumi) writes:

> Is this change correct?  Or am I breaking something?

As far as the m68k is concerned, your change is correct, but it needs
to be applied to the R_68K_PC32 relocation as well.  However, you need
to break out these relocations from the common __i386__ || __m68k__
case as the i386 does not use addends; I have yet to see a R_68K_GOT32
type relocation in an object, though.


> diff -uF^[a-zA-Z_][a-z 	A-Z0-9_]*(.*[^;]$ libexec/ld.elf_so/reloc.c.orig libexec/ld.elf_so/reloc.c
> --- libexec/ld.elf_so/reloc.c.orig	Mon Aug 23 14:07:24 1999
> +++ libexec/ld.elf_so/reloc.c	Tue Oct 19 01:16:03 1999
> @@ -212,7 +212,8 @@ _rtld_relocate_nonplt_object(obj, rela, 
>  		if (def == NULL)
>  			return -1;
>  
> -		*where += (Elf_Addr)(defobj->relocbase + def->st_value);
> +		*where = (Elf_Addr)(defobj->relocbase + def->st_value +
> +		    rela->r_addend);
>  		rdbg(dodebug, ("32 %s in %s --> %p in %s",
>  		    defobj->strtab + def->st_name, obj->path,
>  		    (void *)*where, defobj->path));