Pregunta

A coworker and I ran into this odd error today using the following version of LD:

$ mb-ld --version
GNU ld (GNU Binutils) 2.21.53.20110813
Copyright 2011 Free Software Foundation, Inc.

This is part of the GNU toolchain with MicroBlaze architecture support distributed as part of the Xilinx ISE 14.4 Embedded Development Kit (EDK) tools. My build platform is Red Hat Enterprise Linux Server release 5.9 for x86_64.

More generally, some other questions come to mind:

  1. Is there a master list of all GNU ld relocation types?
  2. If not, then is there a way to interrogate my specific version of LD to determine what a relocation type means?
¿Fue útil?

Solución

1. Is there a master list of all GNU ld relocation types?

No, it is based on the hardware architecture

2. If not, then is there a way to interrogate my specific version of LD to determine what a relocation type means?

Kinda, you can find the types for your hardware. Microblaze is a soft cpu, but it mimics the architecture of the PowerPC. After a quick google on "PowerPC relocation types" I found http://math-atlas.sourceforge.net/devel/assembly/elfspec_ppc.pdf (table 4-8) we have the following relocation types

Table 4-8 Relocation Types
Name                       Value Field      Calculation
R_PPC_NONE                 0     none       none
R_PPC_ADDR32               1     word32     S + A
R_PPC_ADDR24               2     low24*     (S + A) >> 2
R_PPC_ADDR16               3     half16*    S + A
R_PPC_ADDR16_LO            4     half16     #lo(S + A)
R_PPC_ADDR16_HI            5     half16     #hi(S + A)
R_PPC_ADDR16_HA            6     half16     #ha(S + A)
R_PPC_ADDR14               7     low14*     (S + A) >> 2
R_PPC_ADDR14_BRTAKEN       8     low14*     (S + A) >> 2
R_PPC_ADDR14_BRNTAKEN      9     low14*     (S + A) >> 2
R_PPC_REL24                10    low24*     (S + A - P) >> 2
R_PPC_REL14                11    low14*     (S + A - P) >> 2
R_PPC_REL14_BRTAKEN        12    low14*     (S + A - P) >> 2
R_PPC_REL14_BRNTAKEN       13    low14*     (S + A - P) >> 2
R_PPC_GOT16                14    half16*    G + A
R_PPC_GOT16_LO             15    half16     #lo(G + A)
R_PPC_GOT16_HI             16    half16     #hi(G + A)
R_PPC_GOT16_HA             17    half16     #ha(G + A)
R_PPC_PLTREL24             18    low24*     (L + A - P) >> 2
R_PPC_COPY                 19    none       none
R_PPC_GLOB_DAT             20    word32     S + A
R_PPC_JMP_SLOT             21    none       see below
R_PPC_RELATIVE             22    word32     B + A
R_PPC_LOCAL24PC            23    low24*     see below
R_PPC_UADDR32              24    word32     S + A
R_PPC_UADDR16              25    half16*    S + A
R_PPC_REL32                26    word32     S + A - P
R_PPC_PLT32                27    word32     L + A

My guess is that these will be the same for MicroBlaze (maybe with R_MB instead of R_PPC in the name). Of course there should be an official document somewhere that will tell you exactly what is going on, I haven't found it thou.

Otros consejos

use objdump.exe with option -r to find the relocation types for each symbol in your output. I don't know where the types are documented.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top