This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello! We have an existing toolchain for our own architecture that should be extended by my binutils port. Now, some of these tools we would like to reuse make the assumption that a byte in our target's ELF-binary contains 16 bits. I have taken a closer look at 'bits_per_byte'=16 of the 'bfd_arch_info_type' in the 'bfd/cpu-target.c' file: const bfd_arch_info_type bfd_spear32_arch = { 32, /* 32 bits per word */ 32, /* 32 bits per address */ 16, /* 16 bits per byte */ ... }; It seems that this is not quite it. I could see from an unlinked object file that 'fixP->where' must be divided by 2 in spear32_md_apply_fix() in 'gas/config/tc-spear32.c' in order for fixups to appear at their right positions: void spear32_md_apply_fix(fixS *fixP, valueT * valP, segT seg) { long value = *valP; fixP->where /= 2; if (fixP->fx_pcrel == 1) value -= 1; gas_cgen_md_apply_fix(fixP, (valueT *)&value, seg); } Now I experience a problem in '_bfd_relocate_contents()' in 'bfd/reloc.c' where the address of a relocatable instruction is given as an index to a 16-bit instruction, but 'bfd_get16(location)' seems to be interpreting the location value as a byte index: -- Begin crt0.o -- 0000000 <_start>: _start(): 0: 01 10 ldhi r1,0 0: R_SPEAR32_4TH __bss_start 1: 01 20 ldliu r1,0x0 1: R_SPEAR32_3RD __bss_start 2: 81 a1 sli r1,0x8 3: 01 20 ldliu r1,0x0 3: R_SPEAR32_HI __bss_start ... -- End crt0.o -- -- Begin Debug -- in spear32_final_link_relocate() R_SPEAR32_4TH in _bfd_relocate_contents() Reading value: 1001 from 0110 (little endian) // Correct! --------------------------- in spear32_final_link_relocate() R_SPEAR32_3RD in bfd_relocate_contents() Reading value: 0110 at location: 1001 (little endian) // Not correct, location should be 0120 --------------------------- in spear32_final_link_relocate() R_SPEAR32_HI in bfd_relocate_contents() Reading value: 8120 at location: 2081 (little endian) // Not correct, location should be 0120 ... -- End Debug -- Where is my mistake? Are there any other parts of the binutils that would need to be changed in order to get this work? Cheers, Martin
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |