[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/12327] x86 relocatable kernel is broken
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/12327] x86 relocatable kernel is broken |
Date: |
Fri, 17 Dec 2010 00:08:58 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=12327
--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2010-12-17 00:08:43
UTC ---
Another testcase from:
http://sourceware.org/ml/binutils/2010-12/msg00519.html
--
> Your patch doesn't work. I got
>
> ./ld: kernel image bigger than KERNEL_IMAGE_SIZE
>
> due to arch/x86/kernel/vmlinux.lds:
>
> ----
> /*
> * Build-time check on the image size:
> */
> . = ASSERT((_end - _text <= (512 * 1024 * 1024)),
> "kernel image bigger than KERNEL_IMAGE_SIZE");
Extracting the relevant parts from the kernel link script:
SECTIONS
{
. = 0xc000;
.text :
{
_text = .;
*(.text)
}
_end = .;
}
ASSERT (_end - _text <= 0x100, "fail");
You'd think that under the new rules, this ought to work. "_end" is
an absolute address, so when evaluating "_end - _text", "_text" ought
to be converted from relative to absolute, the subtraction resuling in
an absolute address. Then 0x100 gets converted from a number to
absolute address before being compared.
The trouble is that "_end" is *not* treated as an absolute address but
as a plain number. That makes ld convert "_end" to a .text relative
address when evaluation "_end - _text", which doesn't cause a problem
at that stage, but the result is a relative address. That means 0x100
is converted to a .text relative address too, which gives the wrong
result.
The underlying problem is that we don't distinguish between plain
numbers and absolute addresses once values are stored in symbols.
--
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
- [Bug ld/12327] New: x86 relocatable kernel is broken, hjl.tools at gmail dot com, 2010/12/15
- [Bug ld/12327] x86 relocatable kernel is broken, hjl.tools at gmail dot com, 2010/12/15
- [Bug ld/12327] x86 relocatable kernel is broken, address@hidden, 2010/12/16
- [Bug ld/12327] x86 relocatable kernel is broken, hjl.tools at gmail dot com, 2010/12/16
- [Bug ld/12327] x86 relocatable kernel is broken, hjl.tools at gmail dot com, 2010/12/16
- [Bug ld/12327] x86 relocatable kernel is broken,
hjl.tools at gmail dot com <=
- [Bug ld/12327] x86 relocatable kernel is broken, cvs-commit at gcc dot gnu.org, 2010/12/28
- [Bug ld/12327] x86 relocatable kernel is broken, hjl.tools at gmail dot com, 2010/12/28
- [Bug ld/12327] x86 relocatable kernel is broken, cvs-commit at gcc dot gnu.org, 2010/12/28