Commit Graph

37 Commits

Author SHA1 Message Date
Cameron Zwarich fcf51fd298 Roll out r126425 and r126450 to see if it fixes the failures on the buildbots.
llvm-svn: 126488
2011-02-25 16:30:32 +00:00
Devang Patel b037383a35 Enable DebugInfo support for COFF object files.
Patch by Nathan Jeffords!

llvm-svn: 126425
2011-02-24 21:04:00 +00:00
Rafael Espindola 490d02a334 Gas is very inconsistent about when a relaxation/relocation is needed. Do
the right thing and stop trying to copy it. Fixes PR8944.

llvm-svn: 125648
2011-02-16 03:25:55 +00:00
Rafael Espindola 0f8abeba1d Merge IsFixupFullyResolved and IsSymbolRefDifferenceFullyResolved. We now
have a single point where targets test if a relocation is needed.

llvm-svn: 122549
2010-12-24 21:22:02 +00:00
Rafael Espindola b403e098a1 Merge isAbsolute into IsSymbolRefDifferenceFullyResolved.
llvm-svn: 122148
2010-12-18 06:27:54 +00:00
Rafael Espindola 8396dd0893 Remove the MCObjectFormat class.
llvm-svn: 122147
2010-12-18 05:37:28 +00:00
Daniel Dunbar f2adf782ab MC/ObjectWriter: Add a new IsSymbolRefDifferenceFullyResolved target format specific hook.
- Currently just has stub implementations for Mach-O, ELF, and COFF.

llvm-svn: 122037
2010-12-17 04:54:54 +00:00
Daniel Dunbar 50269280f8 MC/Assembler: Strip out object writer arguments, now that it is always available
-- and remove FIXME asking for the same!

llvm-svn: 122032
2010-12-17 02:45:59 +00:00
Rafael Espindola 93e3cf0ebd Sorry for such a large commit. The summary is that only MachO cares about the
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.

llvm-svn: 121076
2010-12-07 00:27:36 +00:00
Rafael Espindola 45790b82af Use getSymbolOffset on the COFF writer.
llvm-svn: 120979
2010-12-06 03:24:04 +00:00
Michael J. Spencer 447762da85 Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Rafael Espindola 8a3a7923eb Define generic 1, 2 and 4 byte pc relative relocations. They are common
and at least the 4 byte one will be needed to implement the .cfi_* directives.

llvm-svn: 120240
2010-11-28 14:17:56 +00:00
Michael J. Spencer 31041a9967 Fix Warnings.
llvm-svn: 117062
2010-10-21 20:49:38 +00:00
Michael J. Spencer 17990d5690 MC-COFF: Add support for default-null weak externals.
llvm-svn: 116666
2010-10-16 08:25:57 +00:00
Michael J. Spencer a6a984bd96 MC-COFF: Fix .bss section size. Fixes PR8335. Patch by NAKAMUTA Takumi!
llvm-svn: 116155
2010-10-09 16:04:45 +00:00
Michael J. Spencer be52c62a6d MC-COFF: Assert on non-coff sections.
llvm-svn: 116148
2010-10-09 11:00:37 +00:00
Michael J. Spencer aaf4643a31 MC-COFF: Handle relaxation in COFF better. Fixes PR8321.
llvm-svn: 116013
2010-10-07 23:55:40 +00:00
Michael J. Spencer a65d17a5ca Fix Punctuation.
llvm-svn: 115657
2010-10-05 19:48:12 +00:00
Michael J. Spencer a3b34ed2df MC-COFF: Fix (PR8278) temporary symbol relocations.
llvm-svn: 115656
2010-10-05 19:48:03 +00:00
Rafael Espindola bce26a1ee0 On ELF we need to know which symbols are used in relocations to decide if
they should be in the symbol table or not. Instead of "guessing", just compute
the symbol table after the relocations are known.

llvm-svn: 115619
2010-10-05 15:11:03 +00:00
Rafael Espindola 70d6e0e0ff Correctly produce R_X86_64_32 or R_X86_64_32S.
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.

llvm-svn: 115134
2010-09-30 03:11:42 +00:00
Rafael Espindola 2ebaee9c75 Make it possible for the MCObjectWriter to decide if a given fixup is fully
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.

llvm-svn: 115131
2010-09-30 02:22:20 +00:00
Michael J. Spencer 86a6222469 MC-COFF: Fix symbol storage class for globals
llvm-svn: 115020
2010-09-29 03:13:41 +00:00
Michael J. Spencer ce2e535b19 MC-COFF: Fix signed/unsigned comparison.
llvm-svn: 114888
2010-09-27 21:17:39 +00:00
Michael J. Spencer d628377a2d MC-COFF: Drop empty sections, and label symbols. Convert relocations
targeted at symbols into relocations relative to the containing section.

Patch by Nathan Jeffords!

llvm-svn: 114823
2010-09-27 08:58:26 +00:00
Michael J. Spencer ccd28d0665 Fix COFF x86-64 relocations. PR7960.
Multiple symbol reloc handling part of the patch by Cameron Esfahani.

llvm-svn: 111963
2010-08-24 21:04:52 +00:00
Michael J. Spencer 377aa20e6e MC: Add partial x86-64 support to COFF.
llvm-svn: 111728
2010-08-21 05:58:13 +00:00
Michael J. Spencer 54cfd42c33 MC: Fix symbol fragment offsets in COFF.
Patch by Cameron Esfahani!

llvm-svn: 110104
2010-08-03 05:02:46 +00:00
Michael J. Spencer d32764c8a0 Revert "MC: Fix symbol fragment offsets in COFF."
This reverts commit r110100

Wrong path caps.

llvm-svn: 110103
2010-08-03 04:53:28 +00:00
Michael J. Spencer a6cfbeb98c MC: Add time travel support to COFF.
llvm-svn: 110101
2010-08-03 04:43:33 +00:00
Michael J. Spencer cf3d8b4ec4 MC: Fix symbol fragment offsets in COFF.
Patch by Cameron Esfahani!

llvm-svn: 110100
2010-08-03 04:43:24 +00:00
Daniel Dunbar 727be43a3d Silence some -Asserts uninitialized variable warnings.
llvm-svn: 109956
2010-07-31 21:08:54 +00:00
Benjamin Kramer c2997dde85 COFFObjectWriter: Don't leak COFFSymbols and COFFSections.
llvm-svn: 109745
2010-07-29 11:57:59 +00:00
Douglas Gregor 675b162512 Fix format-specifier warning
llvm-svn: 109391
2010-07-26 03:55:44 +00:00
Michael J. Spencer c21293792e MC: Fix whitespace error from last commit.
A Visual C++ extension that removes trailing new lines? Seriously?

llvm-svn: 109390
2010-07-26 03:01:28 +00:00
Michael J. Spencer b5fc138547 MC: Add WinCOFFObjectWriter implementation.
Origonal Windows COFF implementation by Nathan Jedffords.

llvm-svn: 109389
2010-07-26 02:17:32 +00:00
Chris Lattner 2c52b7997c introduce WinCOFFObjectWriter, patch by Michael Spencer!
llvm-svn: 108103
2010-07-11 22:07:02 +00:00