Skip to contentSkip to conversation

ld:arch/x86/kernel/vmlinux.lds:678: parse error

DISCUSSION Jean Delvare 2 participants 3 messages Aug 3, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Sam,

I am not able to build Linus' latest kernel on my oldest test system. I get the following linking error at the end:

LD .tmp_vmlinux1
ld:arch/x86/kernel/vmlinux.lds:678: parse error

Which is:

ASSERT((_end - 0xC0000000 <= (512 * 1024 * 1024)),
"kernel image bigger than KERNEL_IMAGE_SIZE")

Apparently this assertion is relatively new, as I was able to build kernel 2.6.29 on the same system. The system has binutils 2.14.90.0.6, which is more recent than what is listed in Documentation/Changes (2.12).

Any idea?

Thanks,

Signature · 1 line
Jean Delvare
#1 lore raw
Quoted 13 lines · Jean Delvare

Hi Sam,

I am not able to build Linus' latest kernel on my oldest test system. I get the following linking error at the end:

LD .tmp_vmlinux1
ld:arch/x86/kernel/vmlinux.lds:678: parse error

Which is:

ASSERT((_end - 0xC0000000 <= (512 * 1024 * 1024)),
"kernel image bigger than KERNEL_IMAGE_SIZE")

Quoted 7 lines

Apparently this assertion is relatively new, as I was able to build kernel 2.6.29 on the same system. The system has binutils 2.14.90.0.6, which is more recent than what is listed in Documentation/Changes (2.12).

Any idea?

Old binutils doesn't accept the naked ASSERT(); there has to be a sink for the data; so one has to do crap like:

__junk_symbol = ASSERT(...);

or

. = ASSERT(...);

near the end.

Does this patch fix it for you?

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
arch/x86/kernel/vmlinux.lds.S +6 -7
index 59f31d2..2eb6874 100644
@@ -407,12 +407,12 @@ INIT_PER_CPU(irq_stack_union);
 /*
  * Build-time check on the image size:
  */
-ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
-	"kernel image bigger than KERNEL_IMAGE_SIZE")
+. = ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
+	   "kernel image bigger than KERNEL_IMAGE_SIZE");
 
 #ifdef CONFIG_SMP
-ASSERT((per_cpu__irq_stack_union == 0),
-        "irq_stack_union is not at start of per-cpu area");
+. = ASSERT((per_cpu__irq_stack_union == 0),
+           "irq_stack_union is not at start of per-cpu area");
 #endif
 
 #endif /* CONFIG_X86_32 */
@@ -420,7 +420,6 @@ ASSERT((per_cpu__irq_stack_union == 0),
 #ifdef CONFIG_KEXEC
 #include <asm/kexec.h>
 
-ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
-       "kexec control code size is too big")
+. = ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
+           "kexec control code size is too big");
 #endif
-
#2 lore raw

Hi Peter,

Thanks for your fast answer.

Quoted 27 lines · H. Peter Anvin
Quoted 13 lines · Jean Delvare

Hi Sam,

I am not able to build Linus' latest kernel on my oldest test system. I get the following linking error at the end:

LD .tmp_vmlinux1
ld:arch/x86/kernel/vmlinux.lds:678: parse error

Which is:

ASSERT((_end - 0xC0000000 <= (512 * 1024 * 1024)),
"kernel image bigger than KERNEL_IMAGE_SIZE")

Quoted 7 lines

Apparently this assertion is relatively new, as I was able to build kernel 2.6.29 on the same system. The system has binutils 2.14.90.0.6, which is more recent than what is listed in Documentation/Changes (2.12).

Any idea?

Old binutils doesn't accept the naked ASSERT(); there has to be a sink for the data; so one has to do crap like:

__junk_symbol = ASSERT(...);

Quoted 7 lines

or

. = ASSERT(...);

near the end.

Does this patch fix it for you?

You patch doesn't, because you forgot to fix the one ASSERT() call that failed for me ;) but the updated version below does indeed fix the build for me:

arch/x86/kernel/vmlinux.lds.S +8 -8
Index: linux-2.6.31-rc5/arch/x86/kernel/vmlinux.lds.S
===================================================================
@@ -393,8 +393,8 @@
 
 
 #ifdef CONFIG_X86_32
-ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
-        "kernel image bigger than KERNEL_IMAGE_SIZE")
+. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
+	   "kernel image bigger than KERNEL_IMAGE_SIZE");
 #else
 /*
  * Per-cpu symbols which need to be offset from __per_cpu_load
@@ -407,12 +407,12 @@
 /*
  * Build-time check on the image size:
  */
-ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
-	"kernel image bigger than KERNEL_IMAGE_SIZE")
+. = ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
+	   "kernel image bigger than KERNEL_IMAGE_SIZE");
 
 #ifdef CONFIG_SMP
-ASSERT((per_cpu__irq_stack_union == 0),
-        "irq_stack_union is not at start of per-cpu area");
+. = ASSERT((per_cpu__irq_stack_union == 0),
+           "irq_stack_union is not at start of per-cpu area");
 #endif
 
 #endif /* CONFIG_X86_32 */
@@ -420,7 +420,7 @@
 #ifdef CONFIG_KEXEC
 #include <asm/kexec.h>
 
-ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
-       "kexec control code size is too big")
+. = ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
+           "kexec control code size is too big");
 #endif
 

So I guess you can send this to Linus. Thanks!

Signature · 1 line
Jean Delvare