OpenCloudOS-Kernel/tools/perf/util/intel-pt-decoder
Josh Poimboeuf 19072f23d1 x86/asm/decoder: Use explicitly signed chars
When running objtool on a ppc64le host to analyze x86 binaries, it
reports a lot of false warnings like:

  ipc/compat_mq.o: warning: objtool: compat_SyS_mq_open()+0x91: can't find jump dest instruction at .text+0x3a5

The warnings are caused by the x86 instruction decoder setting the wrong
value for the jump instruction's immediate field because it assumes that
"char == signed char", which isn't true for all architectures.  When
converting char to int, gcc sign-extends on x86 but doesn't sign-extend
on ppc64le.

According to the gcc man page, that's a feature, not a bug:

  > Each kind of machine has a default for what "char" should be.  It is
  > either like "unsigned char" by default or like "signed char" by
  > default.
  >
  > Ideally, a portable program should always use "signed char" or
  > "unsigned char" when it depends on the signedness of an object.

Conform to the "standards" by changing the "char" casts to "signed
char".  This results in no actual changes to the object code on x86.

Note: the x86 decoder now lives in three different locations in the
kernel tree, which are all kept in sync via makefile checks and
warnings: in-kernel, perf, and objtool.  This fixes all three locations.
Eventually we should probably try to at least converge the two separate
"tools" locations into a single shared location.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/9dd4161719b20e6def9564646d68bfbe498c549f.1456962210.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-03-03 16:13:00 +01:00
..
Build perf tools: Display build warning if x86 instruction decoder differs from kernel 2015-09-04 12:01:01 -03:00
gen-insn-attr-x86.awk perf tools: Add Intel PT instruction decoder 2015-08-17 11:11:36 -03:00
inat.c perf tools: Fix tarball build broken by pt/bts 2015-08-22 12:27:07 -03:00
inat.h perf tools: Fix tarball build broken by pt/bts 2015-08-22 12:27:07 -03:00
inat_types.h perf tools: Fix tarball build broken by pt/bts 2015-08-22 12:27:07 -03:00
insn.c x86/asm/decoder: Use explicitly signed chars 2016-03-03 16:13:00 +01:00
insn.h perf tools: Fix tarball build broken by pt/bts 2015-08-22 12:27:07 -03:00
intel-pt-decoder.c perf intel-pt: Fix potential loop forever 2015-09-28 16:44:31 -03:00
intel-pt-decoder.h perf tools: Add Intel PT support for decoding MTC packets 2015-08-24 17:46:56 -03:00
intel-pt-insn-decoder.c perf tools: Fix build on powerpc broken by pt/bts 2015-08-31 15:47:33 -03:00
intel-pt-insn-decoder.h perf tools: Add Intel PT instruction decoder 2015-08-17 11:11:36 -03:00
intel-pt-log.c perf intel-pt: Make logging slightly more efficient 2015-09-28 16:45:26 -03:00
intel-pt-log.h perf intel-pt: Make logging slightly more efficient 2015-09-28 16:45:26 -03:00
intel-pt-pkt-decoder.c perf tools: Add new Intel PT packet definitions 2015-08-24 17:46:06 -03:00
intel-pt-pkt-decoder.h perf tools: Add new Intel PT packet definitions 2015-08-24 17:46:06 -03:00
x86-opcode-map.txt x86/insn: perf tools: Add new xsave instructions 2015-09-04 12:01:04 -03:00