Commit 8dcf86ca authored by Peter Oberparleiter's avatar Peter Oberparleiter Committed by Stephen Rothwell

vmlinux.lds.h: Fix incomplete .text.exit discards

Enabling CONFIG_GCOV_PROFILE_ALL=y causes linker errors on ARM:

  `.text.exit' referenced in section `.ARM.exidx.text.exit':
  defined in discarded section `.text.exit'

  `.text.exit' referenced in section `.fini_array.00100':
  defined in discarded section `.text.exit'

And related errors on NDS32:

  `.text.exit' referenced in section `.dtors.65435':
  defined in discarded section `.text.exit'

The gcov compiler flags cause certain compiler versions to generate
additional destructor-related sections that are not yet handled by the
linker script, resulting in references between discarded and
non-discarded sections.

Since destructors are not used in the Linux kernel, fix this by
discarding these additional sections.
Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
Tested-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Reported-by: default avatarGreentime Hu <green.hu@gmail.com>
Tested-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
parent 0778a9f2
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#define ARM_DISCARD \ #define ARM_DISCARD \
*(.ARM.exidx.exit.text) \ *(.ARM.exidx.exit.text) \
*(.ARM.extab.exit.text) \ *(.ARM.extab.exit.text) \
*(.ARM.exidx.text.exit) \
*(.ARM.extab.text.exit) \
ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \ ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \
ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \ ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \
ARM_EXIT_DISCARD(EXIT_TEXT) \ ARM_EXIT_DISCARD(EXIT_TEXT) \
......
...@@ -613,8 +613,8 @@ ...@@ -613,8 +613,8 @@
#define EXIT_DATA \ #define EXIT_DATA \
*(.exit.data .exit.data.*) \ *(.exit.data .exit.data.*) \
*(.fini_array) \ *(.fini_array .fini_array.*) \
*(.dtors) \ *(.dtors .dtors.*) \
MEM_DISCARD(exit.data*) \ MEM_DISCARD(exit.data*) \
MEM_DISCARD(exit.rodata*) MEM_DISCARD(exit.rodata*)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment