This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gold patch committed (Was: Re: Help needed to track down bug: linking Linux kernel with gold creates unbootable kernel)
On 04/23/2010 07:49 AM, Ian Lance Taylor 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.
With latest CVS gold I get this error:
objcopy -R .comment -S vmlinux arch/x86/boot/compressed/vmlinux.bin
objcopy:arch/x86/boot/compressed/vmlinux.bin[.text]: File truncated
objcopy:arch/x86/boot/compressed/vmlinux.bin: File truncated
Looks like objcopy doesn't like something about vmlinux.
$ ls -l vmlinux
-rwxr-xr-x 1 edwin edwin 10879216 Apr 23 16:58 vmlinux
strace of the obcopy:
lseek(5, 64, SEEK_CUR) = 64
write(5,
"\1\0\0\0\5\0\0\0@Ld\257D\v\0\0\0\0\0\201\377\377\377\377\0\0\0\1\0\0\0\0"...,
336) = 336
lseek(5, 12389628264448, SEEK_SET) = -1 EINVAL (Invalid argument)
write(2, "objcopy", 7objcopy) = 7
write(2, ":arch/x86/boot/compressed/vmlinu"...,
44:arch/x86/boot/compressed/vmlinux.bin[.text]) = 44
write(2, ": File truncated\n", 17: File truncated
See the ELF headers below.
Should I upload vmlinux to the bugreport? (or some other file?)
Section Headers:
[Nr] Name Type Addr Off Size
ES Flags Lk Inf Al
[ 0] NULL 0000000000000000 00000000
00000000 0 0 0 0
[ 1] .text PROGBITS ffffffff81000000 00001000
003d1c15 0 AX 0 0 4096
[ 2] .notes NOTE ffffffff813d1c18 003d2c18
00000024 0 A 0 0 4
[ 3] __ex_table PROGBITS ffffffff813d1c40 003d2c40
000040c0 0 A 0 0 8
[ 4] .rodata PROGBITS ffffffff81400000 00401000
001b7222 0 A 0 0 64
[ 5] __bug_table PROGBITS ffffffff815b7228 005b8228
000054a8 0 A 0 0 1
[ 6] .pci_fixup PROGBITS ffffffff815bc6d0 005bd6d0
00001720 0 A 0 0 16
[ 7] __ksymtab PROGBITS ffffffff815bddf0 005bedf0
0000bc80 0 A 0 0 16
[ 8] __ksymtab_gpl PROGBITS ffffffff815c9a70 005caa70
00005e30 0 A 0 0 16
[ 9] __kcrctab PROGBITS ffffffff815cf8a0 005d08a0
00005e40 0 A 0 0 8
[10] __kcrctab_gpl PROGBITS ffffffff815d56e0 005d66e0
00002f18 0 A 0 0 8
[11] __ksymtab_strings PROGBITS ffffffff815d85f8 005d95f8
00013e53 0 A 0 0 1
[12] __init_rodata PROGBITS ffffffff815ec450 005ed450
00003bc0 0 A 0 0 16
[13] __param PROGBITS ffffffff815f0010 005f1010
00001ff0 0 A 0 0 8
[14] .data PROGBITS ffffffff81600000 005f3000
00183220 0 WA 0 0 4096
[15] .vsyscall_0 PROGBITS ffffffffff600000 00777000
000000ce 0 AX 0 0 1
[16] .vsyscall_fn PROGBITS ffffffffff600100 00777100
0000003f 0 AX 0 0 1
[17] .vsyscall_gtod_data PROGBITS ffffffffff600140 00777140
00000060 0 WA 0 0 16
[18] .vsyscall_1 PROGBITS ffffffffff600400 00777400
0000003c 0 AX 0 0 1
[19] .vsyscall_2 PROGBITS ffffffffff600800 00777800
00000066 0 AX 0 0 1
[20] .vgetcpu_mode PROGBITS ffffffffff600870 00777870
00000004 0 WA 0 0 16
[21] .jiffies PROGBITS ffffffffff600880 00777880
00000008 0 WA 0 0 16
[22] .data.percpu PROGBITS 0000000000000000 00778000
00014628 0 WA 0 0 4096
[23] .init.text PROGBITS ffffffff8179a000 0078d000
0002fe1b 0 AX 0 0 16
[24] .init.data PROGBITS ffffffff817c9e20 007bce20
000353e0 0 WA 0 0 16
[25] .x86_cpu_dev.init PROGBITS ffffffff817ff200 007f2200
00000018 0 A 0 0 8
[26] .altinstructions PROGBITS ffffffff817ff218 007f2218
00000a4c 0 A 0 0 8
[27] .altinstr_replacement PROGBITS ffffffff817ffc64 007f2c64
00000266 0 AX 0 0 1
[28] .exit.text PROGBITS ffffffff817ffeca 007f2eca
00000cbe 0 AX 0 0 1
[29] .smp_locks PROGBITS ffffffff81801000 007f4000
00009000 0 A 0 0 8
[30] .data_nosave PROGBITS ffffffff8180a000 007fd000
00001000 0 WA 0 0 4
[31] .bss NOBITS ffffffff8180b000 007fe000
044db998 0 WA 0 0 4096
[32] .brk NOBITS ffffffff85ce7000 04cda000
00020000 0 WA 0 0 1
[33] .comment PROGBITS 0000000000000000 007fe000
0000001d 1 MS 0 0 1
[34] .symtab SYMTAB 0000000000000000 007fe020
0013aa90 24 35 37444 8
[35] .strtab STRTAB 0000000000000000 00938ab0
00126b68 0 0 0 1
[36] .shstrtab STRTAB 0000000000000000 00a5f618
00000192 0 0 0 1
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz
MemSiz Flg Align
LOAD 0x001000 0xffffffff81000000 0x0000000001000000 0x5f2000
0x5f2000 R E 0x7fff3a5e9140
LOAD 0x5f3000 0xffffffff81600000 0x0000000001600000 0x183220
0x183220 RWE 0x7fff3a5e9140
LOAD 0x777000 0xffffffffff600000 0x0000000001784000 0x000888
0x000888 R E 0x7fff3a5e9140
LOAD 0x778000 0x0000000000000000 0x0000000001785000 0x014628
0x014628 RW 0x7fff3a5e9140
LOAD 0x78d000 0xffffffff8179a000 0x000000000179a000 0x071000
0x456d000 RWE 0x7fff3a5e9140
NOTE 0x3d2c18 0xffffffff813d1c18 0x00000000013d1c18 0x000024
0x000024 0x4
Best regards,
--Edwin