All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip:x86/asm 3/3] lib/bug.c:135: undefined reference to `__start___bug_table'
@ 2017-03-30 13:02 kbuild test robot
  2017-03-30 15:49 ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: kbuild test robot @ 2017-03-30 13:02 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: kbuild-all, linux-kernel, tipbuild, Ingo Molnar

[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/asm
head:   19d436268dde95389c616bb3819da73f0a8b28a8
commit: 19d436268dde95389c616bb3819da73f0a8b28a8 [3/3] debug: Add _ONCE() logic to report_bug()
config: arm-efm32_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 19d436268dde95389c616bb3819da73f0a8b28a8
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   lib/lib.a(bug.o): In function `find_bug':
>> lib/bug.c:135: undefined reference to `__start___bug_table'
>> lib/bug.c:135: undefined reference to `__stop___bug_table'

vim +135 lib/bug.c

7664c5a1 Jeremy Fitzhardinge 2006-12-08  129  #endif
7664c5a1 Jeremy Fitzhardinge 2006-12-08  130  
19d43626 Peter Zijlstra      2017-02-25  131  struct bug_entry *find_bug(unsigned long bugaddr)
7664c5a1 Jeremy Fitzhardinge 2006-12-08  132  {
19d43626 Peter Zijlstra      2017-02-25  133  	struct bug_entry *bug;
7664c5a1 Jeremy Fitzhardinge 2006-12-08  134  
7664c5a1 Jeremy Fitzhardinge 2006-12-08 @135  	for (bug = __start___bug_table; bug < __stop___bug_table; ++bug)
b93a531e Jan Beulich         2008-12-16  136  		if (bugaddr == bug_addr(bug))
7664c5a1 Jeremy Fitzhardinge 2006-12-08  137  			return bug;
7664c5a1 Jeremy Fitzhardinge 2006-12-08  138  

:::::: The code at line 135 was first introduced by commit
:::::: 7664c5a1da4711bb6383117f51b94c8dc8f3f1cd [PATCH] Generic BUG implementation

:::::: TO: Jeremy Fitzhardinge <jeremy@goop.org>
:::::: CC: Linus Torvalds <torvalds@woody.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 11202 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/asm 3/3] lib/bug.c:135: undefined reference to `__start___bug_table'
  2017-03-30 13:02 [tip:x86/asm 3/3] lib/bug.c:135: undefined reference to `__start___bug_table' kbuild test robot
@ 2017-03-30 15:49 ` Peter Zijlstra
  2017-03-30 15:53   ` Peter Zijlstra
  2017-04-03  8:27   ` [tip:x86/asm] debug: Fix __bug_table[] in arch linker scripts tip-bot for Peter Zijlstra
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Zijlstra @ 2017-03-30 15:49 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, linux-kernel, tipbuild, Ingo Molnar

On Thu, Mar 30, 2017 at 09:02:31PM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/asm
> head:   19d436268dde95389c616bb3819da73f0a8b28a8
> commit: 19d436268dde95389c616bb3819da73f0a8b28a8 [3/3] debug: Add _ONCE() logic to report_bug()
> config: arm-efm32_defconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         git checkout 19d436268dde95389c616bb3819da73f0a8b28a8
>         # save the attached .config to linux build tree
>         make.cross ARCH=arm 
> 
> All errors (new ones prefixed by >>):
> 
>    lib/lib.a(bug.o): In function `find_bug':
> >> lib/bug.c:135: undefined reference to `__start___bug_table'
> >> lib/bug.c:135: undefined reference to `__stop___bug_table'

Blergh.. this cures it for me.

Ideally all those would use RW_DATA_SECTION, but alas.

---
 arch/arm/kernel/vmlinux-xip.lds.S  | 2 ++
 arch/arm/kernel/vmlinux.lds.S      | 2 ++
 arch/avr32/kernel/vmlinux.lds.S    | 1 +
 arch/blackfin/kernel/vmlinux.lds.S | 2 ++
 arch/c6x/kernel/vmlinux.lds.S      | 2 ++
 arch/cris/kernel/vmlinux.lds.S     | 2 ++
 arch/frv/kernel/vmlinux.lds.S      | 2 ++
 arch/ia64/kernel/vmlinux.lds.S     | 2 ++
 arch/mips/kernel/vmlinux.lds.S     | 1 +
 arch/powerpc/kernel/vmlinux.lds.S  | 2 ++
 arch/x86/kernel/vmlinux.lds.S      | 1 +
 11 files changed, 19 insertions(+)

diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S
index 37b2a11..8265b11 100644
--- a/arch/arm/kernel/vmlinux-xip.lds.S
+++ b/arch/arm/kernel/vmlinux-xip.lds.S
@@ -242,6 +242,8 @@ SECTIONS
 	}
 	_edata_loc = __data_loc + SIZEOF(.data);
 
+	BUG_TABLE
+
 #ifdef CONFIG_HAVE_TCM
         /*
 	 * We align everything to a page boundary so we can
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index ce18007..c83a7ba 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -262,6 +262,8 @@ SECTIONS
 	}
 	_edata_loc = __data_loc + SIZEOF(.data);
 
+	BUG_TABLE
+
 #ifdef CONFIG_HAVE_TCM
         /*
 	 * We align everything to a page boundary so we can
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 17f2730..623d18d 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -75,6 +75,7 @@ SECTIONS
 
 		_edata = .;
 	}
+	BUG_TABLE
 
 	BSS_SECTION(0, 8, 8)
 	_end = .;
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 68069a1..334ef81 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -115,6 +115,8 @@ SECTIONS
 	__data_lma = LOADADDR(.data);
 	__data_len = SIZEOF(.data);
 
+	BUG_TABLE
+
 	/* The init section should be last, so when we free it, it goes into
 	 * the general memory pool, and (hopefully) will decrease fragmentation
 	 * a tiny bit. The init section has a _requirement_ that it be
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S
index a1a5c16..29ebea4 100644
--- a/arch/c6x/kernel/vmlinux.lds.S
+++ b/arch/c6x/kernel/vmlinux.lds.S
@@ -128,6 +128,8 @@ SECTIONS
 		. = ALIGN(8);
 	}
 
+	BUG_TABLE
+
 	_edata = .;
 
 	__bss_start = .;
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S
index 9795862..867f237 100644
--- a/arch/cris/kernel/vmlinux.lds.S
+++ b/arch/cris/kernel/vmlinux.lds.S
@@ -68,6 +68,8 @@ SECTIONS
 	__edata = . ;			/* End of data section. */
 	_edata = . ;
 
+	BUG_TABLE
+
 	INIT_TASK_DATA_SECTION(PAGE_SIZE)
 
 	. = ALIGN(PAGE_SIZE);		/* Init code and data. */
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index aa6e573..3f44dcb 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -102,6 +102,8 @@ SECTIONS
 
   _edata = .;			/* End of data section */
 
+  BUG_TABLE
+
   /* GP section */
   . = ALIGN(L1_CACHE_BYTES);
   _gp = . + 2048;
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index f89d20c..798026d 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -192,6 +192,8 @@ SECTIONS {
 		CONSTRUCTORS
 	}
 
+	BUG_TABLE
+
 	. = ALIGN(16);	/* gp must be 16-byte aligned for exc. table */
 	.got : AT(ADDR(.got) - LOAD_OFFSET) {
 		*(.got.plt)
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index f0a0e6d..8ca2371 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -97,6 +97,7 @@ SECTIONS
 		DATA_DATA
 		CONSTRUCTORS
 	}
+	BUG_TABLE
 	_gp = . + 0x8000;
 	.lit8 : {
 		*(.lit8)
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 7394b77..1c24c89 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -312,6 +312,8 @@ SECTIONS
 		NOSAVE_DATA
 	}
 
+	BUG_TABLE
+
 	. = ALIGN(PAGE_SIZE);
 	_edata  =  .;
 	PROVIDE32 (edata = .);
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index c74ae9c..c8a3b61 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -146,6 +146,7 @@ SECTIONS
 		_edata = .;
 	} :data
 
+	BUG_TABLE
 
 	. = ALIGN(PAGE_SIZE);
 	__vvar_page = .;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [tip:x86/asm 3/3] lib/bug.c:135: undefined reference to `__start___bug_table'
  2017-03-30 15:49 ` Peter Zijlstra
@ 2017-03-30 15:53   ` Peter Zijlstra
  2017-03-31  0:27     ` Fengguang Wu
  2017-04-03  8:27   ` [tip:x86/asm] debug: Fix __bug_table[] in arch linker scripts tip-bot for Peter Zijlstra
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2017-03-30 15:53 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, linux-kernel, tipbuild, Ingo Molnar

On Thu, Mar 30, 2017 at 05:49:27PM +0200, Peter Zijlstra wrote:
> On Thu, Mar 30, 2017 at 09:02:31PM +0800, kbuild test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/asm
> > head:   19d436268dde95389c616bb3819da73f0a8b28a8
> > commit: 19d436268dde95389c616bb3819da73f0a8b28a8 [3/3] debug: Add _ONCE() logic to report_bug()
> > config: arm-efm32_defconfig (attached as .config)
> > compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
> > reproduce:
> >         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         git checkout 19d436268dde95389c616bb3819da73f0a8b28a8
> >         # save the attached .config to linux build tree
> >         make.cross ARCH=arm 
> > 
> > All errors (new ones prefixed by >>):
> > 
> >    lib/lib.a(bug.o): In function `find_bug':
> > >> lib/bug.c:135: undefined reference to `__start___bug_table'
> > >> lib/bug.c:135: undefined reference to `__stop___bug_table'
> 
> Blergh.. this cures it for me.
> 
> Ideally all those would use RW_DATA_SECTION, but alas.
> 

> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index c74ae9c..c8a3b61 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -146,6 +146,7 @@ SECTIONS
>  		_edata = .;
>  	} :data
>  
> +	BUG_TABLE
>  
>  	. = ALIGN(PAGE_SIZE);
>  	__vvar_page = .;

Also, I have absolutely 0 clues as to why x86 builds without this :/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/asm 3/3] lib/bug.c:135: undefined reference to `__start___bug_table'
  2017-03-30 15:53   ` Peter Zijlstra
@ 2017-03-31  0:27     ` Fengguang Wu
  0 siblings, 0 replies; 7+ messages in thread
From: Fengguang Wu @ 2017-03-31  0:27 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: kbuild-all, linux-kernel, tipbuild, Ingo Molnar

On Thu, Mar 30, 2017 at 05:53:27PM +0200, Peter Zijlstra wrote:
>On Thu, Mar 30, 2017 at 05:49:27PM +0200, Peter Zijlstra wrote:
>> On Thu, Mar 30, 2017 at 09:02:31PM +0800, kbuild test robot wrote:
>> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/asm
>> > head:   19d436268dde95389c616bb3819da73f0a8b28a8
>> > commit: 19d436268dde95389c616bb3819da73f0a8b28a8 [3/3] debug: Add _ONCE() logic to report_bug()
>> > config: arm-efm32_defconfig (attached as .config)
>> > compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
>> > reproduce:
>> >         wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> >         chmod +x ~/bin/make.cross
>> >         git checkout 19d436268dde95389c616bb3819da73f0a8b28a8
>> >         # save the attached .config to linux build tree
>> >         make.cross ARCH=arm
>> >
>> > All errors (new ones prefixed by >>):
>> >
>> >    lib/lib.a(bug.o): In function `find_bug':
>> > >> lib/bug.c:135: undefined reference to `__start___bug_table'
>> > >> lib/bug.c:135: undefined reference to `__stop___bug_table'
>>
>> Blergh.. this cures it for me.
>>
>> Ideally all those would use RW_DATA_SECTION, but alas.
>>
>
>> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
>> index c74ae9c..c8a3b61 100644
>> --- a/arch/x86/kernel/vmlinux.lds.S
>> +++ b/arch/x86/kernel/vmlinux.lds.S
>> @@ -146,6 +146,7 @@ SECTIONS
>>  		_edata = .;
>>  	} :data
>>
>> +	BUG_TABLE
>>
>>  	. = ALIGN(PAGE_SIZE);
>>  	__vvar_page = .;
>
>Also, I have absolutely 0 clues as to why x86 builds without this :/

Yes there are no x86 build failures with this error message.
It only occurs in arm and c6x.

Regards,
Fengguang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip:x86/asm] debug: Fix __bug_table[] in arch linker scripts
  2017-03-30 15:49 ` Peter Zijlstra
  2017-03-30 15:53   ` Peter Zijlstra
@ 2017-04-03  8:27   ` tip-bot for Peter Zijlstra
  2017-04-03  9:57     ` hpa
  1 sibling, 1 reply; 7+ messages in thread
From: tip-bot for Peter Zijlstra @ 2017-04-03  8:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, linux-kernel, mingo, tglx, fengguang.wu, hpa, peterz

Commit-ID:  b5effd3815ccbe3df1a015a6d67d8a24a27813d5
Gitweb:     http://git.kernel.org/tip/b5effd3815ccbe3df1a015a6d67d8a24a27813d5
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Thu, 30 Mar 2017 17:49:27 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 3 Apr 2017 10:22:40 +0200

debug: Fix __bug_table[] in arch linker scripts

The kbuild test robot reported this build failure on a number
of architectures:

 >         make.cross ARCH=arm
 >    lib/lib.a(bug.o): In function `find_bug':
 > >> lib/bug.c:135: undefined reference to `__start___bug_table'
 > >> lib/bug.c:135: undefined reference to `__stop___bug_table'

Caused by:

  19d436268dde ("debug: Add _ONCE() logic to report_bug()")

Which moved the BUG_TABLE from RO_DATA_SECTION() to RW_DATA_SECTION(),
but a number of architectures don't use RW_DATA_SECTION(), so they
ended up with no __bug_table[] ...

Ideally all those would use RW_DATA_SECTION() in their linker scripts,
but that's for another day.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kbuild test robot <fengguang.wu@intel.com>
Cc: kbuild-all@01.org
Cc: tipbuild@zytor.com
Link: http://lkml.kernel.org/r/20170330154927.o6qmgfp4bdhrajbm@hirez.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/arm/kernel/vmlinux-xip.lds.S  | 2 ++
 arch/arm/kernel/vmlinux.lds.S      | 2 ++
 arch/avr32/kernel/vmlinux.lds.S    | 1 +
 arch/blackfin/kernel/vmlinux.lds.S | 2 ++
 arch/c6x/kernel/vmlinux.lds.S      | 2 ++
 arch/cris/kernel/vmlinux.lds.S     | 2 ++
 arch/frv/kernel/vmlinux.lds.S      | 2 ++
 arch/ia64/kernel/vmlinux.lds.S     | 2 ++
 arch/mips/kernel/vmlinux.lds.S     | 1 +
 arch/powerpc/kernel/vmlinux.lds.S  | 2 ++
 arch/x86/kernel/vmlinux.lds.S      | 1 +
 11 files changed, 19 insertions(+)

diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S
index 37b2a11..8265b11 100644
--- a/arch/arm/kernel/vmlinux-xip.lds.S
+++ b/arch/arm/kernel/vmlinux-xip.lds.S
@@ -242,6 +242,8 @@ SECTIONS
 	}
 	_edata_loc = __data_loc + SIZEOF(.data);
 
+	BUG_TABLE
+
 #ifdef CONFIG_HAVE_TCM
         /*
 	 * We align everything to a page boundary so we can
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index ce18007..c83a7ba 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -262,6 +262,8 @@ SECTIONS
 	}
 	_edata_loc = __data_loc + SIZEOF(.data);
 
+	BUG_TABLE
+
 #ifdef CONFIG_HAVE_TCM
         /*
 	 * We align everything to a page boundary so we can
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 17f2730..623d18d 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -75,6 +75,7 @@ SECTIONS
 
 		_edata = .;
 	}
+	BUG_TABLE
 
 	BSS_SECTION(0, 8, 8)
 	_end = .;
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 68069a1..334ef81 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -115,6 +115,8 @@ SECTIONS
 	__data_lma = LOADADDR(.data);
 	__data_len = SIZEOF(.data);
 
+	BUG_TABLE
+
 	/* The init section should be last, so when we free it, it goes into
 	 * the general memory pool, and (hopefully) will decrease fragmentation
 	 * a tiny bit. The init section has a _requirement_ that it be
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S
index a1a5c16..29ebea4 100644
--- a/arch/c6x/kernel/vmlinux.lds.S
+++ b/arch/c6x/kernel/vmlinux.lds.S
@@ -128,6 +128,8 @@ SECTIONS
 		. = ALIGN(8);
 	}
 
+	BUG_TABLE
+
 	_edata = .;
 
 	__bss_start = .;
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S
index 9795862..867f237 100644
--- a/arch/cris/kernel/vmlinux.lds.S
+++ b/arch/cris/kernel/vmlinux.lds.S
@@ -68,6 +68,8 @@ SECTIONS
 	__edata = . ;			/* End of data section. */
 	_edata = . ;
 
+	BUG_TABLE
+
 	INIT_TASK_DATA_SECTION(PAGE_SIZE)
 
 	. = ALIGN(PAGE_SIZE);		/* Init code and data. */
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index aa6e573..3f44dcb 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -102,6 +102,8 @@ SECTIONS
 
   _edata = .;			/* End of data section */
 
+  BUG_TABLE
+
   /* GP section */
   . = ALIGN(L1_CACHE_BYTES);
   _gp = . + 2048;
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index f89d20c..798026d 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -192,6 +192,8 @@ SECTIONS {
 		CONSTRUCTORS
 	}
 
+	BUG_TABLE
+
 	. = ALIGN(16);	/* gp must be 16-byte aligned for exc. table */
 	.got : AT(ADDR(.got) - LOAD_OFFSET) {
 		*(.got.plt)
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index f0a0e6d..8ca2371 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -97,6 +97,7 @@ SECTIONS
 		DATA_DATA
 		CONSTRUCTORS
 	}
+	BUG_TABLE
 	_gp = . + 0x8000;
 	.lit8 : {
 		*(.lit8)
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 7394b77..1c24c89 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -312,6 +312,8 @@ SECTIONS
 		NOSAVE_DATA
 	}
 
+	BUG_TABLE
+
 	. = ALIGN(PAGE_SIZE);
 	_edata  =  .;
 	PROVIDE32 (edata = .);
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index c74ae9c..c8a3b61 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -146,6 +146,7 @@ SECTIONS
 		_edata = .;
 	} :data
 
+	BUG_TABLE
 
 	. = ALIGN(PAGE_SIZE);
 	__vvar_page = .;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [tip:x86/asm] debug: Fix __bug_table[] in arch linker scripts
  2017-04-03  8:27   ` [tip:x86/asm] debug: Fix __bug_table[] in arch linker scripts tip-bot for Peter Zijlstra
@ 2017-04-03  9:57     ` hpa
  2017-04-03 12:25       ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: hpa @ 2017-04-03  9:57 UTC (permalink / raw)
  To: linux-tip-commits, tip-bot for Peter Zijlstra
  Cc: torvalds, linux-kernel, mingo, tglx, fengguang.wu, peterz

On April 3, 2017 1:27:49 AM PDT, tip-bot for Peter Zijlstra <tipbot@zytor.com> wrote:
>Commit-ID:  b5effd3815ccbe3df1a015a6d67d8a24a27813d5
>Gitweb:    
>http://git.kernel.org/tip/b5effd3815ccbe3df1a015a6d67d8a24a27813d5
>Author:     Peter Zijlstra <peterz@infradead.org>
>AuthorDate: Thu, 30 Mar 2017 17:49:27 +0200
>Committer:  Ingo Molnar <mingo@kernel.org>
>CommitDate: Mon, 3 Apr 2017 10:22:40 +0200
>
>debug: Fix __bug_table[] in arch linker scripts
>
>The kbuild test robot reported this build failure on a number
>of architectures:
>
> >         make.cross ARCH=arm
> >    lib/lib.a(bug.o): In function `find_bug':
> > >> lib/bug.c:135: undefined reference to `__start___bug_table'
> > >> lib/bug.c:135: undefined reference to `__stop___bug_table'
>
>Caused by:
>
>  19d436268dde ("debug: Add _ONCE() logic to report_bug()")
>
>Which moved the BUG_TABLE from RO_DATA_SECTION() to RW_DATA_SECTION(),
>but a number of architectures don't use RW_DATA_SECTION(), so they
>ended up with no __bug_table[] ...
>
>Ideally all those would use RW_DATA_SECTION() in their linker scripts,
>but that's for another day.
>
>Signed-off-by: Peter Zijlstra <peterz@infradead.org>
>Cc: Linus Torvalds <torvalds@linux-foundation.org>
>Cc: Thomas Gleixner <tglx@linutronix.de>
>Cc: kbuild test robot <fengguang.wu@intel.com>
>Cc: kbuild-all@01.org
>Cc: tipbuild@zytor.com
>Link:
>http://lkml.kernel.org/r/20170330154927.o6qmgfp4bdhrajbm@hirez.programming.kicks-ass.net
>Signed-off-by: Ingo Molnar <mingo@kernel.org>
>---
> arch/arm/kernel/vmlinux-xip.lds.S  | 2 ++
> arch/arm/kernel/vmlinux.lds.S      | 2 ++
> arch/avr32/kernel/vmlinux.lds.S    | 1 +
> arch/blackfin/kernel/vmlinux.lds.S | 2 ++
> arch/c6x/kernel/vmlinux.lds.S      | 2 ++
> arch/cris/kernel/vmlinux.lds.S     | 2 ++
> arch/frv/kernel/vmlinux.lds.S      | 2 ++
> arch/ia64/kernel/vmlinux.lds.S     | 2 ++
> arch/mips/kernel/vmlinux.lds.S     | 1 +
> arch/powerpc/kernel/vmlinux.lds.S  | 2 ++
> arch/x86/kernel/vmlinux.lds.S      | 1 +
> 11 files changed, 19 insertions(+)
>
>diff --git a/arch/arm/kernel/vmlinux-xip.lds.S
>b/arch/arm/kernel/vmlinux-xip.lds.S
>index 37b2a11..8265b11 100644
>--- a/arch/arm/kernel/vmlinux-xip.lds.S
>+++ b/arch/arm/kernel/vmlinux-xip.lds.S
>@@ -242,6 +242,8 @@ SECTIONS
> 	}
> 	_edata_loc = __data_loc + SIZEOF(.data);
> 
>+	BUG_TABLE
>+
> #ifdef CONFIG_HAVE_TCM
>         /*
> 	 * We align everything to a page boundary so we can
>diff --git a/arch/arm/kernel/vmlinux.lds.S
>b/arch/arm/kernel/vmlinux.lds.S
>index ce18007..c83a7ba 100644
>--- a/arch/arm/kernel/vmlinux.lds.S
>+++ b/arch/arm/kernel/vmlinux.lds.S
>@@ -262,6 +262,8 @@ SECTIONS
> 	}
> 	_edata_loc = __data_loc + SIZEOF(.data);
> 
>+	BUG_TABLE
>+
> #ifdef CONFIG_HAVE_TCM
>         /*
> 	 * We align everything to a page boundary so we can
>diff --git a/arch/avr32/kernel/vmlinux.lds.S
>b/arch/avr32/kernel/vmlinux.lds.S
>index 17f2730..623d18d 100644
>--- a/arch/avr32/kernel/vmlinux.lds.S
>+++ b/arch/avr32/kernel/vmlinux.lds.S
>@@ -75,6 +75,7 @@ SECTIONS
> 
> 		_edata = .;
> 	}
>+	BUG_TABLE
> 
> 	BSS_SECTION(0, 8, 8)
> 	_end = .;
>diff --git a/arch/blackfin/kernel/vmlinux.lds.S
>b/arch/blackfin/kernel/vmlinux.lds.S
>index 68069a1..334ef81 100644
>--- a/arch/blackfin/kernel/vmlinux.lds.S
>+++ b/arch/blackfin/kernel/vmlinux.lds.S
>@@ -115,6 +115,8 @@ SECTIONS
> 	__data_lma = LOADADDR(.data);
> 	__data_len = SIZEOF(.data);
> 
>+	BUG_TABLE
>+
> 	/* The init section should be last, so when we free it, it goes into
>	 * the general memory pool, and (hopefully) will decrease
>fragmentation
> 	 * a tiny bit. The init section has a _requirement_ that it be
>diff --git a/arch/c6x/kernel/vmlinux.lds.S
>b/arch/c6x/kernel/vmlinux.lds.S
>index a1a5c16..29ebea4 100644
>--- a/arch/c6x/kernel/vmlinux.lds.S
>+++ b/arch/c6x/kernel/vmlinux.lds.S
>@@ -128,6 +128,8 @@ SECTIONS
> 		. = ALIGN(8);
> 	}
> 
>+	BUG_TABLE
>+
> 	_edata = .;
> 
> 	__bss_start = .;
>diff --git a/arch/cris/kernel/vmlinux.lds.S
>b/arch/cris/kernel/vmlinux.lds.S
>index 9795862..867f237 100644
>--- a/arch/cris/kernel/vmlinux.lds.S
>+++ b/arch/cris/kernel/vmlinux.lds.S
>@@ -68,6 +68,8 @@ SECTIONS
> 	__edata = . ;			/* End of data section. */
> 	_edata = . ;
> 
>+	BUG_TABLE
>+
> 	INIT_TASK_DATA_SECTION(PAGE_SIZE)
> 
> 	. = ALIGN(PAGE_SIZE);		/* Init code and data. */
>diff --git a/arch/frv/kernel/vmlinux.lds.S
>b/arch/frv/kernel/vmlinux.lds.S
>index aa6e573..3f44dcb 100644
>--- a/arch/frv/kernel/vmlinux.lds.S
>+++ b/arch/frv/kernel/vmlinux.lds.S
>@@ -102,6 +102,8 @@ SECTIONS
> 
>   _edata = .;			/* End of data section */
> 
>+  BUG_TABLE
>+
>   /* GP section */
>   . = ALIGN(L1_CACHE_BYTES);
>   _gp = . + 2048;
>diff --git a/arch/ia64/kernel/vmlinux.lds.S
>b/arch/ia64/kernel/vmlinux.lds.S
>index f89d20c..798026d 100644
>--- a/arch/ia64/kernel/vmlinux.lds.S
>+++ b/arch/ia64/kernel/vmlinux.lds.S
>@@ -192,6 +192,8 @@ SECTIONS {
> 		CONSTRUCTORS
> 	}
> 
>+	BUG_TABLE
>+
> 	. = ALIGN(16);	/* gp must be 16-byte aligned for exc. table */
> 	.got : AT(ADDR(.got) - LOAD_OFFSET) {
> 		*(.got.plt)
>diff --git a/arch/mips/kernel/vmlinux.lds.S
>b/arch/mips/kernel/vmlinux.lds.S
>index f0a0e6d..8ca2371 100644
>--- a/arch/mips/kernel/vmlinux.lds.S
>+++ b/arch/mips/kernel/vmlinux.lds.S
>@@ -97,6 +97,7 @@ SECTIONS
> 		DATA_DATA
> 		CONSTRUCTORS
> 	}
>+	BUG_TABLE
> 	_gp = . + 0x8000;
> 	.lit8 : {
> 		*(.lit8)
>diff --git a/arch/powerpc/kernel/vmlinux.lds.S
>b/arch/powerpc/kernel/vmlinux.lds.S
>index 7394b77..1c24c89 100644
>--- a/arch/powerpc/kernel/vmlinux.lds.S
>+++ b/arch/powerpc/kernel/vmlinux.lds.S
>@@ -312,6 +312,8 @@ SECTIONS
> 		NOSAVE_DATA
> 	}
> 
>+	BUG_TABLE
>+
> 	. = ALIGN(PAGE_SIZE);
> 	_edata  =  .;
> 	PROVIDE32 (edata = .);
>diff --git a/arch/x86/kernel/vmlinux.lds.S
>b/arch/x86/kernel/vmlinux.lds.S
>index c74ae9c..c8a3b61 100644
>--- a/arch/x86/kernel/vmlinux.lds.S
>+++ b/arch/x86/kernel/vmlinux.lds.S
>@@ -146,6 +146,7 @@ SECTIONS
> 		_edata = .;
> 	} :data
> 
>+	BUG_TABLE
> 
> 	. = ALIGN(PAGE_SIZE);
> 	__vvar_page = .;

Case in point why we want structured linker tables, btw...
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/asm] debug: Fix __bug_table[] in arch linker scripts
  2017-04-03  9:57     ` hpa
@ 2017-04-03 12:25       ` Peter Zijlstra
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Zijlstra @ 2017-04-03 12:25 UTC (permalink / raw)
  To: hpa
  Cc: linux-tip-commits, tip-bot for Peter Zijlstra, torvalds,
	linux-kernel, mingo, tglx, fengguang.wu

On Mon, Apr 03, 2017 at 02:57:48AM -0700, hpa@zytor.com wrote:
> On April 3, 2017 1:27:49 AM PDT, tip-bot for Peter Zijlstra <tipbot@zytor.com> wrote:
> >diff --git a/arch/x86/kernel/vmlinux.lds.S
> >b/arch/x86/kernel/vmlinux.lds.S
> >index c74ae9c..c8a3b61 100644
> >--- a/arch/x86/kernel/vmlinux.lds.S
> >+++ b/arch/x86/kernel/vmlinux.lds.S
> >@@ -146,6 +146,7 @@ SECTIONS
> > 		_edata = .;
> > 	} :data
> > 
> >+	BUG_TABLE
> > 
> > 	. = ALIGN(PAGE_SIZE);
> > 	__vvar_page = .;
> 
> Case in point why we want structured linker tables, btw...

Yes.

Btw, can you explain why x86 builds and works without this patch?
Because as far as I understand this (which isn't very far), we should
fail linking with an unresolved symbol without this.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-03 12:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30 13:02 [tip:x86/asm 3/3] lib/bug.c:135: undefined reference to `__start___bug_table' kbuild test robot
2017-03-30 15:49 ` Peter Zijlstra
2017-03-30 15:53   ` Peter Zijlstra
2017-03-31  0:27     ` Fengguang Wu
2017-04-03  8:27   ` [tip:x86/asm] debug: Fix __bug_table[] in arch linker scripts tip-bot for Peter Zijlstra
2017-04-03  9:57     ` hpa
2017-04-03 12:25       ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.