bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/3267] New: Ld converts section relative symbols to absolute symb


From: vgoyal at redhat dot com
Subject: [Bug ld/3267] New: Ld converts section relative symbols to absolute symbols in zero sized sectoins
Date: 26 Sep 2006 16:50:46 -0000

ld does not conform to the behaviour as specifed in "info ld" and converts
section relative symbols to absolute symbols for zero sized sections. Following
is the problem description and disussion thread.

http://sourceware.org/ml/binutils/2006-09/msg00305.html

I am copying and pasting the orinal problem description.

I got a query. Ld behaviour does not seem to be conforming to what is mentioned
in "info ld"

I was going through the info ld and found following in the section 3.6.7 "Output
Section Discarding"

   "If you use anything other than an input section description as an
output section command, such as a symbol assignment, then the output
section will always be created, even if there are no matching input
sections."

I am compiling my kernel and I don't seem to be getting above mentioned
behaviour. For, example vmlinux.ld.S has got following code.

  .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
        __smp_alt_begin = .;
        __smp_alt_instructions = .;
        *(.smp_altinstructions)
        __smp_alt_instructions_end = .;
  }


In finally generated executable, thre is no section as .smp_altinstructions and
symbols __smp_alt_begin, __smp_alt_instructions
and __smp_alt_instructions_end have become absolute symbols.

Looks like there was no section .smp_altinstructions present in input files
hence linker did not create output section and made symbols absolute. This does
not match the behaviour as stated in "info ld". Is this a bug or design intent?

I am using GNU ld version 2.17.50.0.3-1

HOW AM I IMPACTED:
--------------------

Now we are trying to make i386 kernel fully relocatable. We compile the kernel
with option --emit-relocs and use this relocation information to relocate the
kernel at run time. But as per the specifications absolute symbols are not to be
relocated.

Now, above compiler makes some symbols absolute and these symbols are not
relocated and kernel code fails at some point. In this case kernel fails because
it is trying to free memory between symbol __smp_alt_begin and another symbol
present in other section. __smp_alt_begin is now absolute and does not get
relocated and kernel ends up trying to free a wrong portion of memory.

Do you have any thoughts about what's the right way of fixing the issue?  Its a
linker bug or it should be fixed in kernel?

-- 
           Summary: Ld converts section relative symbols to absolute symbols
                    in zero sized sectoins
           Product: binutils
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: vgoyal at redhat dot com
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=3267

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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