On Tue, Jun 23, 2020 at 06:49:40PM -0700, Kees Cook wrote: > We don't want to depend on the linker's orphan section placement > heuristics as these can vary between linkers, and may change between > versions. All sections need to be explicitly named in the linker > script. > > Avoid .eh_frame* by making sure both -fno-asychronous-unwind-tables and > -fno-unwind-tables are present in both CFLAGS and AFLAGS. Remove one > last instance of .eh_frame by removing the needless Call Frame Information > annotations from arch/arm64/kernel/smccc-call.S. > > Add .plt, .data.rel.ro, .igot.*, and .iplt to discards as they are not > actually used. While .got.plt is also not used, it must be included > otherwise ld.bfd will fail to link with the error: > > aarch64-linux-gnu-ld: discarded output section: `.got.plt' > > However, as it'd be better to validate that it stays effectively empty, > add an assert. > > Explicitly include debug sections when they're present. > > Fix a case of needless quotes in __section(), which Clang doesn't like. > > Finally, enable orphan section warnings. > > Thanks to Ard Biesheuvel for many hints on correct ways to handle > mysterious sections. :) Sorry to be a pain, but this patch is doing 3 or 4 independent things at once. Please could you split it up a bit? e.g. - Removal of cfi directives from smccc macro - Removal of quotes around section name for clang - Avoid generating .eh_frame - Ensure all sections are accounted for in linker script and warn on orphans That way it's a bit easier to manage, we can revert/backport bits later if necessary and you get more patches in the kernel ;) You can also add my Ack on all the patches: Acked-by: Will Deacon <will@xxxxxxxxxx> Will