actuall addresses in a .o file, so it is better to let the MachO writer compute
it.
This is good for two reasons. First, areas that shouldn't care about
addresses now don't have access to it. Second, the layout of each section
is independent. I should use this in a subsequent commit to speed it up.
Most of the patch is just removing the section address computation. The two
interesting parts are the change on how we handle padding in the end
of sections and how MachO can get the address of a-b when a and b are in
different sections.
Since now the expression evaluation normally doesn't know the section address,
it will think that a-b needs relocation and let the MachO writer know. Once
it has computed the section addresses, it calls back the expression evaluation
with the section addresses to resolve these expressions.
The remaining problem is the handling of padding. Currently it will create
a special alignment fragment at the end. Since that fragment doesn't update
the alignment of the section, it needs the real address to be computed.
Since now the layout will not compute a-b with a and b in different sections,
the only effect that the special alignment fragment has is update the
address size of the section. This can also be done by the MachO writer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121076 91177308-0d34-0410-b5e6-96231b3b80d8
independent information on the Mach object format, and move some stuff from
MachObjectWriter.cpp there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120186 91177308-0d34-0410-b5e6-96231b3b80d8
they should be in the symbol table or not. Instead of "guessing", just compute
the symbol table after the relocations are known.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115619 91177308-0d34-0410-b5e6-96231b3b80d8
where both symbols are "local", that is non-external symbols, and there is
no "base" for the symbols used in the expression, that is the section has
no non-temporary symbols. This case looks like this:
% cat local_reloc_A-B.s
.long 0
LB: .long 1
.long LA - LB - 4
.long 2
LA: .long 3
which llvm-mc will not encode without this patch, generates a "unsupported
local relocations in difference" error, but the Darwin assembler will
encode with relocation entries like this:
% otool -rv a.out l.out
a.out:
Relocation information (__TEXT,__text) 2 entries
address pcrel length extern type scattered symbolnum/value
00000008 False long False SUB False 1 (__TEXT,__text)
00000008 False long False UNSIGND False 1 (__TEXT,__text)
which is very similar to what is encoded when the symbols don't have the
leading 'L' and they are not temporary symbols. Which llvm-mc and the
Darwin assembler will encoded like this:
Relocation information (__TEXT,__text) 2 entries
address pcrel length extern type scattered symbolnum/value
00000008 False long True SUB False B
00000008 False long True UNSIGND False A
This is the missing relocation encoding needed to allow the Mach-O x86
Dwarf file and line table to be emitted. So this patch also removes the
TODO from the if() statement in MCMachOStreamer::Finish() that didn't
call MCDwarfFileTable::Emit() for 64-bit targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115389 91177308-0d34-0410-b5e6-96231b3b80d8
With this patch in
movq $foo, foo(%rip)
foo:
.long foo
We produce a R_X86_64_32S for the first relocation and R_X86_64_32 for the
second one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115134 91177308-0d34-0410-b5e6-96231b3b80d8
resolved or not. Different object files have different restrictions and
different native assemblers have different idiosyncrasies we want to emulate
for now.
Move the existing MachO logic to the new place and implement an ELF one that
gets fixups to globals right.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115131 91177308-0d34-0410-b5e6-96231b3b80d8