This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gold patch committed (Was: Re: Help needed to track down bug: linking Linux kernel with gold creates unbootable kernel)


On Thu, Apr 22, 2010 at 9:49 PM, Ian Lance Taylor <iant@google.com> wrote:
> John Reiser <jreiser@bitwagon.com> writes:
>
>>> Linux kernel linker scripts needs to align .rodata section to 2MB:
>>>
>>> . = ALIGN((1<< ?21));
>>>
>>> Since gold can only align to 4K, gold can't be used on Linux
>>> kernel.
>>
>> The linker script statement ". = ALIGN((1<< ?21));" requires alignment
>> to 2 MiB. ?If gold "can only align to 4 KiB", then gold must emit an
>> error message upon processing input that requires a larger alignment.
>> It is a bug that current gold does not emit such a message for this case.
>
> The problem is that the alignment requested by the linker script is
> not reflected in the linker output. ?That actually appears to be true
> of the GNU linker as well. ?Logically, an alignment requested in the
> linker script should be reflected in the program segments.
>
> I committed this patch to make an alignment requested in the linker
> script be reflected in the p_align field of the generated program
> headers. ?I don't know if this actually fixes the problem, but it
> seems like the right thing to do.
>

It can get quite complicated. What if there is an input with

---
	.text
	.p2align 23
foo:
	nop
---

I think the best linker can do is to issue an error.



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]