[gnu.utils.bug] A portability but in GNU ld in a cross-compiler environment

jkp@SAUNA.HUT.FI (Jyrki Kuoppala) (06/09/89)

Using the latest GNU ld on a sparc machine with the GNU linker
configured for a m68k target machine:

(gdb) r /usr/ressu/users/jkp/gcc-68k/gcc-crt0.o /usr/ressu/users/jkp/foo.o -lc
Starting program: /usr/ressu/users/jkp/tmp/bu/ld /usr/ressu/users/jkp/gcc-68k/gcc-crt0.o /usr/ressu/users/jkp/foo.o -lc

Program received signal 10, Bus error
Reading in symbols for ld.c...done.
perform_relocation (data=(char *) 0xfefff898 "#\300", pc_relocation=0, data_size=60, reloc_info=(struct relocation_info *) 0xfefff870, reloc_size=32, entry=(struct file_entry *) 0x1a7e8) (ld.c line 3981)
(gdb) 

This is in the code in the following place:

	  break;

	case 2:
	  if (RELOC_MEMORY_ADD_P(p))
=>	    relocation += mask & *(long *) (data + addr);
	  *(long *) (data + addr) &= ~mask;
	  *(long *) (data + addr) |= relocation;
	  break;

	default:
	  fatal_with_file ("Unimplemented relocation field length in ", entry);


Some variables:

(gdb) print data
$1 = (char *) 0xfefff898 "#\300"
(gdb) print addr
$2 = 2
(gdb) print mask
$3 = 4294967295
(gdb) print relocation
$4 = 8132
(gdb) 

So, it seems that on a Sparc you can't read a long except from a
longword-aligned address and on this cross-development configuration
alignment this would be needed.

All the programs were compiled with gcc 1.35.

I can provide more information if that's needed.

//Jyrki