1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/test
Ulrich Weigand 89ebba5af6 [PowerPC] Fix processing of ha16/lo16 fixups
The current PowerPC MC back end distinguishes between fixup_ppc_ha16
and fixup_ppc_lo16, which are determined by the instruction the fixup
applies to, and uses this distinction to decide whether a fixup ought
to resolve to the high or the low part of a symbol address.

This isn't quite correct, however.  It is valid -if unusual- assembler
to use, e.g.
  li 1, symbol@ha
or
  lis 1, symbol@l
Whether the high or the low part of the address is used depends solely
on the @ suffix, not on the instruction.

In addition, both
  li 1, symbol
and
  lis 1, symbol
are valid, assuming the symbol address fits into 16 bits; again, both
will then refer to the actual symbol value (so li will load the value
itself, while lis will load the value shifted by 16).


To fix this, two places need to be adapted.  If the fixup cannot be
resolved at assembler time, a relocation needs to be emitted via
PPCELFObjectWriter::getRelocType.  This routine already looks at
the VK_ type to determine the relocation.  The only problem is that
will reject any _LO modifier in a ha16 fixup and vice versa.  This
is simply incorrect; any of those modifiers ought to be accepted
for either fixup type.

If the fixup *can* be resolved at assembler time, adjustFixupValue
currently selects the high bits of the symbol value if the fixup
type is ha16.  Again, this is incorrect; see the above example
  lis 1, symbol

Now, in theory we'd have to respect a VK_ modifier here.  However,
in fact common code never even attempts to resolve symbol references
using any nontrivial VK_ modifier at assembler time; it will always
fall back to emitting a reloc and letting the linker handle it.

If this ever changes, presumably there'd have to be a target callback
to resolve VK_ modifiers.  We'd then have to handle @ha etc. there.

llvm-svn: 182091
2013-05-17 12:36:29 +00:00
..
Analysis AArch64: use MCJIT by default and enable related tests. 2013-05-06 16:51:08 +00:00
Archive
Assembler
Bindings/Ocaml
Bitcode
BugPoint
CodeGen [Sparc] Prevent instructions that defines or uses %o7 to be in call's delay slot. 2013-05-16 23:53:29 +00:00
DebugInfo Generate debug info for by-value struct args even if they are not used. 2013-05-16 23:44:12 +00:00
ExecutionEngine XFAIL this test for mingw too. 2013-05-13 00:18:24 +00:00
Feature Clarify that llvm.used can contain aliases. 2013-04-22 14:58:02 +00:00
FileCheck Add 'CHECK-DAG' support 2013-05-14 20:34:12 +00:00
Instrumentation [msan] Switch TLS globals to initial-exec model. 2013-05-16 09:14:05 +00:00
Integer Rewrite test/Integer tests to use FileCheck instead of grep 2013-04-08 20:18:15 +00:00
JitListener
Linker Rewrite test/Linker tests to use FileCheck instead of grep. 2013-04-09 16:51:13 +00:00
MC [PowerPC] Fix processing of ha16/lo16 fixups 2013-05-17 12:36:29 +00:00
Object Object: Fix Mach-O relocation printing. 2013-05-14 22:41:29 +00:00
Other Attributes: Don't print trailing whitespace on the function attribute comment. 2013-04-19 11:43:21 +00:00
TableGen
tools Use pointers to iterate over symbols. 2013-04-24 19:47:55 +00:00
Transforms Respect the 'nobuiltin' attribute when determining if a call is to a memory builtin. 2013-05-16 04:12:04 +00:00
Unit Propagate path to ASan/MSan symbolizer into test environment to produce useful reports on errors. 2013-04-04 07:41:00 +00:00
Verifier Also verify llvm.compiler_used. 2013-04-22 15:16:51 +00:00
YAMLParser
CMakeLists.txt Add obj2yaml to test dependencies 2013-04-05 07:26:37 +00:00
lit.cfg AArch64: use MCJIT by default and enable related tests. 2013-05-06 16:51:08 +00:00
lit.site.cfg.in Allow host triple to be correctly overridden in CMake builds 2013-05-04 07:36:23 +00:00
Makefile Allow host triple to be correctly overridden in CMake builds 2013-05-04 07:36:23 +00:00
Makefile.tests Remove obsolete object file dumpers 2013-04-12 04:07:13 +00:00
TestRunner.sh