Bug 13783 - Generate static relocation for ldr pc, var
Summary: Generate static relocation for ldr pc, var
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.22
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-29 15:22 UTC by Vladimir
Modified: 2015-02-23 17:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir 2012-02-29 15:22:51 UTC
Hello. I do not know how to fix the problem, so I will describe the situation and its possible solution.
 Have a static code:

 .section FSWI_PATCH1, "ax", %progbits
 .arm 
 ldr pc, main_jumper

 .section FSWI_PATCH2,"ax",%progbits
 .arm

 main_jumper:
 .int swi_handler @ function

 FSWI_PATCH1 and FSWI_PATCH2 have static addresses. But I can`t compile it, give "internal_relocation (type: OFFSET_IMM) not fixed up". IAR compile it fine. I try to find bug in GAS and found this:

 tc-arm.c: 21867:
  case BFD_RELOC_ARM_OFFSET_IMM:
       if (section->use_rela_p)
       {
          code = fixp->fx_r_type;
          break;
       }

 I make it like that:
      if (section->use_rela_p)
       {
         code = fixp->fx_r_type;
         break;
       } else {
          code = BFD_RELOC_ARM_LDR_PC_G0;
          break;
       }

 And it correctly compile and generate 4 bytes of opcode like IAR. I do not know how to correctly fix this error, but the nature of the error, I think you understand.

 Sorry for my english :)
Comment 1 goswin-v-b@web.de 2015-02-23 17:14:46 UTC
Did you mean "ldr pc, =main_jumper"?