x86/build32: Discard all orphaned sections
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 May 2020 18:18:37 +0000 (19:18 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 13 May 2020 19:33:42 +0000 (20:33 +0100)
commit24f94fca23ad7c45806a1428331e1d602dfd8604
treec6d6b7f4d891eb7cd34426d3ea248343a35d6080
parent9f74a7b66b0b03fe563779bb2c133051f1595ece
x86/build32: Discard all orphaned sections

Linkers may put orphaned sections ahead of .text, which breaks the calling
requirements.  A concrete example is Ubuntu's GCC-9 default of enabling
-fcf-protection which causes us to try and execute .note.gnu.properties during
Xen's boot.

Put .got.plt in its own section as it specifically needs preserving from the
linkers point of view, and discard everything else.  This will hopefully be
more robust to other unexpected toolchain properties.

Fixes boot from an Ubuntu build of Xen.

Reported-by: Jason Andryuk <jandryuk@gmail.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Jason Andryuk <jandryuk@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/boot/build32.lds