Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: Don't discard .text.exit section

Commit e41f501d3912 ("vmlinux.lds: account for destructor sections")
added '.text.exit' to EXIT_TEXT which is discarded at link time by default.
This breaks compilation of UML:
`.text.exit' referenced in section `.fini_array' of
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o):
defined in discarded section `.text.exit' of
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o)

Apparently UML doesn't want to discard exit text, so let's place all EXIT_TEXT
sections in .exit.text.

Fixes: e41f501d3912 ("vmlinux.lds: account for destructor sections")
Reported-by: Stefan Traby <stefan@hello-penguin.com>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Richard Weinberger <richard@nod.at>

authored by

Andrey Ryabinin and committed by
Richard Weinberger
dad22328 7a1dcf6a

+1 -1
+1 -1
arch/um/include/asm/common.lds.S
··· 81 81 .altinstr_replacement : { *(.altinstr_replacement) } 82 82 /* .exit.text is discard at runtime, not link time, to deal with references 83 83 from .altinstructions and .eh_frame */ 84 - .exit.text : { *(.exit.text) } 84 + .exit.text : { EXIT_TEXT } 85 85 .exit.data : { *(.exit.data) } 86 86 87 87 .preinit_array : {