public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Linker Bug or Design Intent (Absolute symbols in zero sized sections)
@ 2006-09-26 14:33 Vivek Goyal
  2006-09-26 14:49 ` H. J. Lu
  0 siblings, 1 reply; 43+ messages in thread
From: Vivek Goyal @ 2006-09-26 14:33 UTC (permalink / raw)
  To: binutils

Hi,

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?

Thanks
Vivek

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2006-10-23  2:35 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-26 14:33 Linker Bug or Design Intent (Absolute symbols in zero sized sections) Vivek Goyal
2006-09-26 14:49 ` H. J. Lu
2006-09-26 14:52   ` Vivek Goyal
2006-09-26 15:13     ` H. J. Lu
2006-09-26 15:41       ` Daniel Jacobowitz
2006-09-26 15:54         ` Vivek Goyal
2006-09-26 16:21           ` H. J. Lu
2006-09-26 16:30             ` Vivek Goyal
2006-09-26 16:44               ` H. J. Lu
2006-09-26 16:45                 ` Vivek Goyal
2006-09-26 17:01                 ` Daniel Jacobowitz
2006-09-26 23:50                   ` Alan Modra
2006-09-27  1:51                     ` Daniel Jacobowitz
2006-09-27  3:09                       ` Daniel Jacobowitz
2006-09-26 17:48                 ` Paul Koning
2006-09-26 23:53                   ` Alan Modra
2006-09-28 17:01                     ` Paul Brook
2006-09-28 17:05                       ` Paul Brook
2006-09-28 18:37                       ` H. J. Lu
2006-09-28 18:53                         ` H. J. Lu
2006-10-10 16:41                         ` Jakub Jelinek
2006-10-10 16:51                           ` Jakub Jelinek
2006-10-11  3:52                           ` Jakub Jelinek
2006-10-11  7:12                             ` Jakub Jelinek
2006-10-11  8:04                             ` Alan Modra
2006-10-11 14:08                               ` Alan Modra
2006-10-11 14:19                               ` Jakub Jelinek
2006-10-11 14:45                                 ` Jakub Jelinek
2006-10-12 10:18                                 ` Alan Modra
2006-10-12 14:37                                   ` Alan Modra
2006-10-13 10:58                                   ` Jakub Jelinek
2006-10-13 11:10                                     ` Alan Modra
2006-10-13 11:26                                       ` Alan Modra
2006-10-17 16:02                                   ` Dynamic section symbols, ignored output sections Alan Modra
2006-10-19 14:55                                     ` ligang
2006-10-22  0:25                                     ` Jakub Jelinek
2006-10-23 14:13                                       ` Alan Modra
2006-09-29  6:42                       ` Linker Bug or Design Intent (Absolute symbols in zero sized sections) Alan Modra
2006-09-29  8:06                         ` Alan Modra
2006-09-26 16:14         ` H. J. Lu
2006-09-26 16:40           ` Vivek Goyal
2006-09-26 17:57           ` Vivek Goyal
2006-09-26 20:23             ` H. J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).