x86/power: Move restore_registers() to top of the file
authorJosh Poimboeuf <jpoimboe@redhat.com>
Thu, 21 Jan 2021 21:29:35 +0000 (15:29 -0600)
committerJosh Poimboeuf <jpoimboe@redhat.com>
Tue, 26 Jan 2021 17:33:04 +0000 (11:33 -0600)
commit125f0b7d24216f37a9683b3899fa45101090f098
tree0c4b301cb4bf8af3928fd579b4a60020a5447e0d
parentb682369d47df66ebc157426f7eb991c3eec32e7e
x86/power: Move restore_registers() to top of the file

Because restore_registers() is page-aligned, the assembler inexplicably
adds an unreachable jump from after the end of the previous function to
the beginning of restore_registers().

That confuses objtool, understandably.  It also creates significant text
fragmentation.  As a result, most of the object file is wasted text
(nops).

Move restore_registers() to the beginning of the file to both prevent
the text fragmentation and avoid the dead jump instruction.

$ size /tmp/hibernate_asm_64.before.o /tmp/hibernate_asm_64.after.o
   text    data     bss     dec     hex filename
   4415       0       0    4415    113f /tmp/hibernate_asm_64.before.o
    524       0       0     524     20c /tmp/hibernate_asm_64.after.o

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/8c7f634201d26453d73fe55032cbbdc05d004387.1611263462.git.jpoimboe@redhat.com
arch/x86/power/hibernate_asm_64.S