Darwin assembler improved relocs when w/o subsections_via_symbols.

When the file isn't being built with subsections-via-symbols, symbol
differences involving non-local symbols can be resolved more aggressively.
Needed for gas compatibility.

llvm-svn: 146054
This commit is contained in:
Jim Grosbach 2011-12-07 19:46:59 +00:00
parent 190c712f73
commit d6ae4ba002
5 changed files with 16 additions and 2 deletions

View File

@ -584,9 +584,14 @@ IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
// requires the compiler to use .set to absolutize the differences between // requires the compiler to use .set to absolutize the differences between
// symbols which the compiler knows to be assembly time constants, so we // symbols which the compiler knows to be assembly time constants, so we
// don't need to worry about considering symbol differences fully resolved. // don't need to worry about considering symbol differences fully resolved.
//
// If the file isn't using sub-sections-via-symbols, we can make the
// same assumptions about any symbol that we normally make about
// assembler locals.
if (!Asm.getBackend().hasReliableSymbolDifference()) { if (!Asm.getBackend().hasReliableSymbolDifference()) {
if (!SA.isTemporary() || !SA.isInSection() || &SecA != &SecB) if ((!SA.isTemporary() && Asm.getSubsectionsViaSymbols()) ||
!SA.isInSection() || &SecA != &SecB)
return false; return false;
return true; return true;
} }

View File

@ -62,6 +62,9 @@ static bool getARMFixupKindMachOInfo(unsigned Kind, unsigned &RelocType,
default: default:
return false; return false;
case ARM::fixup_t2_condbranch:
assert(0);
return false;
case FK_Data_1: case FK_Data_1:
Log2Size = llvm::Log2_32(1); Log2Size = llvm::Log2_32(1);
return true; return true;

View File

@ -19,12 +19,14 @@ Ld0_0:
Lsc0_0: Lsc0_0:
.long 0 .long 0
.subsections_via_symbols
@ CHECK: ('cputype', 12) @ CHECK: ('cputype', 12)
@ CHECK: ('cpusubtype', 9) @ CHECK: ('cpusubtype', 9)
@ CHECK: ('filetype', 1) @ CHECK: ('filetype', 1)
@ CHECK: ('num_load_commands', 3) @ CHECK: ('num_load_commands', 3)
@ CHECK: ('load_commands_size', 364) @ CHECK: ('load_commands_size', 364)
@ CHECK: ('flag', 0) @ CHECK: ('flag', 8192)
@ CHECK: ('load_commands', [ @ CHECK: ('load_commands', [
@ CHECK: # Load Command 0 @ CHECK: # Load Command 0
@ CHECK: (('command', 1) @ CHECK: (('command', 1)

View File

@ -12,3 +12,5 @@
.text .text
_a: _a:
call _a call _a
.subsections_via_symbols

View File

@ -60,3 +60,5 @@ L1:
call _c + 1 call _c + 1
// call _a - L0 // call _a - L0
call _b - L0 call _b - L0
.subsections_via_symbols