mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Manoj Gupta <manojgupta@chromium.org>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: clang: objtool: native_machine_emergency_restart() falls through to next function
Date: Fri, 15 Jun 2018 14:14:41 -0700	[thread overview]
Message-ID: <20180615211441.GO88063@google.com> (raw)

Hi Josh,

with your work on objtool and the upcoming implementation of
-fno-delete-null-pointer-checks (https://reviews.llvm.org/D47894,
https://reviews.llvm.org/D47895) in clang most objtool warnings
for clang builds will be fixed.

However even with -fno-delete-null-pointer-checks we currently still
get a warning about native_machine_emergency_restart():

arch/x86/kernel/reboot.o: warning: objtool:
  native_machine_emergency_restart()
  falls through to next function machine_power_off()

This only occurs when building with -Oz.

One of our compiler engineers looked into this, LLVM optimizes the
return statement away since the function has an endless loop, and
actually never returns.

Is there a way to tell objtool that the function is not expected to
return (I tried the attribute __noreturn, but it doesn't make a
difference), or do we have to tell clang to restrain from optimizing
returns out?

To repro:

git checkout v4.16
make CC=clang defconfig
echo "CONFIG_CC_OPTIMIZE_FOR_SIZE=y" >> .config
make CC=clang arch/x86/kernel/reboot.o

Thanks

Matthias

             reply	other threads:[~2018-06-15 21:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15 21:14 Matthias Kaehlcke [this message]
2018-06-18 22:17 ` Josh Poimboeuf
2018-06-18 22:52   ` Matthias Kaehlcke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180615211441.GO88063@google.com \
    --to=mka@chromium.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manojgupta@chromium.org \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome