bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

binutils 2.11: relocations for absolute values


From: Eberhard Mattes
Subject: binutils 2.11: relocations for absolute values
Date: Sun, 26 Aug 2001 11:32:49 +0200

Yes, ld outputs relocations for absolute values, at least for the
arm-epoc-pe target.  Probably that problem exists for all COFF targets.

answer.s:
----------------------------------------------------------------------
        .global answer

answer  =       42
----------------------------------------------------------------------

use.s:
----------------------------------------------------------------------
        .text
        .global start
start:  ldr     r0, ptr
        mov     pc, lr

ptr:    .word   answer
----------------------------------------------------------------------

how to build (after the first ld step it's clear that there's an entry
in use.base for address 8 which shouldn't be there):
----------------------------------------------------------------------
arm-epoc-pe-as -o use.o use.s
arm-epoc-pe-as -o answer.o answer.s
arm-epoc-pe-ld -e start --base-file use.base -o use.exe use.o answer.o
arm-epoc-pe-dlltool --base-file use.base --output-exp exp.o
arm-epoc-pe-ld -e start -o use.exe exp.o use.o answer.o
----------------------------------------------------------------------

This patch *seems* to solve the problem (note that cofflink.c might
need a similar patch), but there might be a better solution, detecting
those "relocations" earlier:

----------------------------------------------------------------------
*** coff-arm.c~ Tue Jan 23 12:45:52 2001
--- coff-arm.c  Sun Aug 26 03:41:36 2001
***************
*** 1546,1552 ****
        if (info->base_file)
        {
          /* Emit a reloc if the backend thinks it needs it.  */
!         if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto))
              arm_emit_base_file_entry (info, output_bfd, input_section, 
rel->r_vaddr);
        }
  
--- 1546,1553 ----
        if (info->base_file)
        {
          /* Emit a reloc if the backend thinks it needs it.  */
!         if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto)
!             && (h == NULL || !bfd_is_abs_section (h->root.u.def.section)))
              arm_emit_base_file_entry (info, output_bfd, input_section, 
rel->r_vaddr);
        }
  
----------------------------------------------------------------------

Eberhard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]