Skip to content

Commit

Permalink
debug: Fix __bug_table[] in arch linker scripts
Browse files Browse the repository at this point in the history
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:

  19d4362 ("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 <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: kbuild test robot <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 3, 2017
1 parent 19d4362 commit b5effd3
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/arm/kernel/vmlinux-xip.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions arch/avr32/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ SECTIONS

_edata = .;
}
BUG_TABLE

BSS_SECTION(0, 8, 8)
_end = .;
Expand Down
2 changes: 2 additions & 0 deletions arch/blackfin/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions arch/c6x/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ SECTIONS
. = ALIGN(8);
}

BUG_TABLE

_edata = .;

__bss_start = .;
Expand Down
2 changes: 2 additions & 0 deletions arch/cris/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 2 additions & 0 deletions arch/frv/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ SECTIONS

_edata = .; /* End of data section */

BUG_TABLE

/* GP section */
. = ALIGN(L1_CACHE_BYTES);
_gp = . + 2048;
Expand Down
2 changes: 2 additions & 0 deletions arch/ia64/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions arch/mips/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ SECTIONS
DATA_DATA
CONSTRUCTORS
}
BUG_TABLE
_gp = . + 0x8000;
.lit8 : {
*(.lit8)
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ SECTIONS
NOSAVE_DATA
}

BUG_TABLE

. = ALIGN(PAGE_SIZE);
_edata = .;
PROVIDE32 (edata = .);
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ SECTIONS
_edata = .;
} :data

BUG_TABLE

. = ALIGN(PAGE_SIZE);
__vvar_page = .;
Expand Down

0 comments on commit b5effd3

Please sign in to comment.