mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
dd88a0a0c8
Arnd Bergmann reported the following warning with GCC 7.1.1: fs/fs_pin.o: warning: objtool: pin_kill()+0x139: stack state mismatch: cfa1=7+88 cfa2=7+96 And the kbuild robot reported the following warnings with GCC 5.4.1: fs/fs_pin.o: warning: objtool: pin_kill()+0x182: return with modified stack frame fs/quota/dquot.o: warning: objtool: dquot_alloc_inode()+0x140: stack state mismatch: cfa1=7+120 cfa2=7+128 fs/quota/dquot.o: warning: objtool: dquot_free_inode()+0x11a: stack state mismatch: cfa1=7+112 cfa2=7+120 Those warnings are caused by an unusual GCC non-optimization where it uses an intermediate register to adjust the stack pointer. It does: lea 0x8(%rsp), %rcx ... mov %rcx, %rsp Instead of the obvious: add $0x8, %rsp It makes no sense to use an intermediate register, so I opened a GCC bug to track it: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81813 But it's not exactly a high-priority bug and it looks like we'll be stuck with this issue for a while. So for now we have to track register values when they're loaded with stack pointer offsets. This is kind of a big workaround for a tiny problem, but c'est la vie. I hope to eventually create a GCC plugin to implement a big chunk of objtool's functionality. Hopefully at that point we'll be able to remove of a lot of these GCC-isms from the objtool code. Reported-by: Arnd Bergmann <arnd@arndb.de> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/6a41a96884c725e7f05413bb7df40cfe824b2444.1504028945.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
56 lines
1.4 KiB
C
56 lines
1.4 KiB
C
/*
|
|
* Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@redhat.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef _OBJTOOL_CFI_H
|
|
#define _OBJTOOL_CFI_H
|
|
|
|
#define CFI_UNDEFINED -1
|
|
#define CFI_CFA -2
|
|
#define CFI_SP_INDIRECT -3
|
|
#define CFI_BP_INDIRECT -4
|
|
|
|
#define CFI_AX 0
|
|
#define CFI_DX 1
|
|
#define CFI_CX 2
|
|
#define CFI_BX 3
|
|
#define CFI_SI 4
|
|
#define CFI_DI 5
|
|
#define CFI_BP 6
|
|
#define CFI_SP 7
|
|
#define CFI_R8 8
|
|
#define CFI_R9 9
|
|
#define CFI_R10 10
|
|
#define CFI_R11 11
|
|
#define CFI_R12 12
|
|
#define CFI_R13 13
|
|
#define CFI_R14 14
|
|
#define CFI_R15 15
|
|
#define CFI_RA 16
|
|
#define CFI_NUM_REGS 17
|
|
|
|
struct cfi_reg {
|
|
int base;
|
|
int offset;
|
|
};
|
|
|
|
struct cfi_state {
|
|
struct cfi_reg cfa;
|
|
struct cfi_reg regs[CFI_NUM_REGS];
|
|
};
|
|
|
|
#endif /* _OBJTOOL_CFI_H */
|