Skip to contentSkip to conversation

x86: relocatable doesn't work with new binutils

BUG Shaohua Li 4 participants 7 messages Dec 17, 2010 x86

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

Hi,
The CONFIG_RELOCATABLE is broken with new binutils, which will make boot panic. According to Lu Hongjiu, the affected binutils are from 2.20.51.0.12 to 2.21.51.0.3, which are release since Oct 22 this year. At least ubuntu 10.10 is using such binutils. see:
http://sourceware.org/bugzilla/show_bug.cgi?id=12327
The reason of boot panic is we have 'jiffies = jiffies_64;' in vmlinux.lds.S. The jiffies isn't in any section. In kernel build, there is warning saying jiffies is an absolute address and can't be relocatable. At runtime, jiffies will have virtual address 0. We can easily workaround this issue by moving jiffies to a section or at least warn people if such binutils are using. what should we do?

Thanks,
Shaohua

#1 lore raw
Quoted 2 lines · Shaohua Li

We can easily workaround this issue by moving jiffies to a section or at least warn people if such binutils are using. what should we do?

I think we should do the workaround, but still get distros to update the broken binutils.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
author
#2 lore raw
Quoted 6 lines · H. Peter Anvin
Quoted 2 lines · Shaohua Li

We can easily workaround this issue by moving jiffies to a section or at least warn people if such binutils are using. what should we do?

I think we should do the workaround, but still get distros to update the broken binutils.

Here is my workaround.
The problem is a lot of kernel versions are affected by this, fix all?

The CONFIG_RELOCATABLE is broken with new binutils, which will make boot panic. According to Lu Hongjiu, the affected binutils are from 2.20.51.0.12 to 2.21.51.0.3, which are release since Oct 22 this year. At least ubuntu 10.10 is using such binutils. see:
http://sourceware.org/bugzilla/show_bug.cgi?id=12327
The reason of boot panic is we have 'jiffies = jiffies_64;' in vmlinux.lds.S. The jiffies isn't in any section. In kernel build, there is warning saying jiffies is an absolute address and can't be relocatable. At runtime, jiffies will have virtual address 0.

---
 arch/x86/kernel/vmlinux.lds.S |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/kernel/vmlinux.lds.S +5 -2
Index: linux/arch/x86/kernel/vmlinux.lds.S
===================================================================
@@ -34,11 +34,9 @@ OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONF
 #ifdef CONFIG_X86_32
 OUTPUT_ARCH(i386)
 ENTRY(phys_startup_32)
-jiffies = jiffies_64;
 #else
 OUTPUT_ARCH(i386:x86-64)
 ENTRY(phys_startup_64)
-jiffies_64 = jiffies;
 #endif
 
 #if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA)
@@ -138,6 +136,11 @@ SECTIONS
 		CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
 
 		DATA_DATA
+#ifdef CONFIG_X86_32
+		jiffies = jiffies_64;
+#else
+		jiffies_64 = jiffies;
+#endif
 		CONSTRUCTORS
 
 		/* rarely changed data like cpu maps */
#3 lore raw
Quoted 9 lines · Shaohua Li
Quoted 6 lines · H. Peter Anvin
Quoted 2 lines · Shaohua Li

We can easily workaround this issue by moving jiffies to a section or at least warn people if such binutils are using. what should we do?

I think we should do the workaround, but still get distros to update the broken binutils.

Here is my workaround.
The problem is a lot of kernel versions are affected by this, fix all?

I suspect the stable kernels should be able to take the patch easily enough.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#4 lore raw

I just released the Linux binutils 2.21.51.0.4:

http://gcc.gnu.org/ml/gcc/2010-12/msg00397.html

H.J.

Quoted 24 lines

-----Original Message-----
From: H. Peter Anvin [mailto:[email protected]]
Sent: Thursday, December 16, 2010 7:25 PM
To: Li, Shaohua
Cc: lkml; Andrew Morton; Lu, Hongjiu; Huang, Ying
Subject: Re: [BUG]x86: relocatable doesn't work with new binutils

Quoted 3 lines · Shaohua Li
Quoted 2 lines · H. Peter Anvin
Quoted 1 line · Shaohua Li

We can easily workaround this issue by moving jiffies to a section

or at

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

least warn people if such binutils are using. what should we do?

I think we should do the workaround, but still get distros to

update the

Quoted 3 lines
Quoted 1 line

broken binutils.

Here is my workaround.
The problem is a lot of kernel versions are affected by this, fix

all?

I suspect the stable kernels should be able to take the patch easily enough.

Quoted 6 lines

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#5 lore raw
In reply to Shaohua Li
Quoted 12 lines · Shaohua Li
Quoted 6 lines · H. Peter Anvin
Quoted 2 lines · Shaohua Li

We can easily workaround this issue by moving jiffies to a section or at least warn people if such binutils are using. what should we do?

I think we should do the workaround, but still get distros to update the broken binutils.

Here is my workaround.
The problem is a lot of kernel versions are affected by this, fix all?

Quoted 10 lines

The CONFIG_RELOCATABLE is broken with new binutils, which will make boot panic. According to Lu Hongjiu, the affected binutils are from 2.20.51.0.12 to 2.21.51.0.3, which are release since Oct 22 this year. At least ubuntu 10.10 is using such binutils. see:
http://sourceware.org/bugzilla/show_bug.cgi?id=12327
The reason of boot panic is we have 'jiffies = jiffies_64;' in vmlinux.lds.S. The jiffies isn't in any section. In kernel build, there is warning saying jiffies is an absolute address and can't be relocatable. At runtime, jiffies will have virtual address 0.

Just curious, what change in binutils caused this? And what build warning did you see? Section mismatch warning?

Thanks.

author
#6 lore raw
Quoted 24 lines · Américo Wang
Quoted 12 lines · Shaohua Li
Quoted 6 lines · H. Peter Anvin
Quoted 2 lines · Shaohua Li

We can easily workaround this issue by moving jiffies to a section or at least warn people if such binutils are using. what should we do?

I think we should do the workaround, but still get distros to update the broken binutils.

Here is my workaround.
The problem is a lot of kernel versions are affected by this, fix all?

Quoted 10 lines

The CONFIG_RELOCATABLE is broken with new binutils, which will make boot panic. According to Lu Hongjiu, the affected binutils are from 2.20.51.0.12 to 2.21.51.0.3, which are release since Oct 22 this year. At least ubuntu 10.10 is using such binutils. see:
http://sourceware.org/bugzilla/show_bug.cgi?id=12327
The reason of boot panic is we have 'jiffies = jiffies_64;' in vmlinux.lds.S. The jiffies isn't in any section. In kernel build, there is warning saying jiffies is an absolute address and can't be relocatable. At runtime, jiffies will have virtual address 0.

Quoted 1 line

Just curious, what change in binutils caused this?

I'm not familiar with binutils, please check the bugzilla.

Quoted 2 lines

And what build
warning did you see? Section mismatch warning?

Something like this: WARNING: Absolute relocations present

Thanks,
Shaohua