Go to file
Ulrich Weigand 994f49ed79 [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
clang [analyzer; alternate edges] improve support for edges with PseudoObjectExprs. 2013-05-17 09:41:40 +00:00
clang-tools-extra cpp11-migrate: Check for valid NULL macros from macro arg expansions 2013-05-16 14:55:05 +00:00
compiler-rt tsan: remove "printing report from signal handler. Can crash or hang" output 2013-05-17 12:05:44 +00:00
debuginfo-tests Remove IR scenario tests. 2013-03-15 20:52:10 +00:00
libclc Update the copyright coredits -- Happy new year 2013! 2013-01-01 10:00:19 +00:00
libcxx Glen: This patch gets the string conversion functions working on Windows. It also refactors repetitive code in string.cpp do greatly reduce the repetitiveness, increasing maintainability. 2013-05-16 17:13:40 +00:00
libcxxabi Add capability to demangle invocation functions for ObjC blocks. 2013-04-10 19:44:03 +00:00
lld [lld][ELF][All Archs] Addend is used by dynamic relocations 2013-05-17 05:10:30 +00:00
lldb Fix a typo (ouput => output) 2013-05-17 12:31:43 +00:00
llvm [PowerPC] Fix processing of ha16/lo16 fixups 2013-05-17 12:36:29 +00:00
polly Update LoopInfo correctly 2013-05-16 06:40:24 +00:00