Rafael Espindola
38c45a939d
Move the support for using .init_array from ARM to the generic
...
TargetLoweringObjectFileELF. Use this to support it on X86. Unlike ARM,
on X86 it is not easy to find out if .init_array should be used or not, so
the decision is made via TargetOptions and defaults to off.
Add a command line option to llc that enables it.
llvm-svn: 158692
2012-06-19 00:48:28 +00:00
Bill Wendling
a9402cc275
Look for the 'Is Simulated' module flag. This indicates that the program is compiled to run on a simulator.
...
llvm-svn: 155435
2012-04-24 11:03:50 +00:00
Anton Korobeynikov
fb863cd279
Fix to make sure that a comdat group gets generated correctly for a static member
...
of instantiated C++ templates.
Patch by Kristof Beyls!
llvm-svn: 151250
2012-02-23 10:36:04 +00:00
David Chisnall
d5d4804858
... and it's probably best to use the correct alignment, rather than just guessing that it's the same as the size.
...
llvm-svn: 150813
2012-02-17 16:30:39 +00:00
David Chisnall
86b0f069d6
It turns out that putting an 8-byte symbol in a 4-byte section makes Solaris ld sulk. GNU ld is perfectly happy with it, which is worrying for a whole other set of reasons...
...
Thanks to Anton, Duncan and Rafael for helping me track this down.
Pointy hat to Rafael for introducing the bug in the first place.
llvm-svn: 150811
2012-02-17 16:05:50 +00:00
Bill Wendling
74a684d991
Use 'getDataNoRel' for the section kind.
...
llvm-svn: 150628
2012-02-15 22:47:53 +00:00
Bill Wendling
d483464dd5
Modify the code that emits the module flags to use the new module flags accessor
...
method. This allows the target lowering code to not have to deal with MDNodes.
Also, avoid leaking memory like a sieve by not creating a global variable for
the image info section, but just emitting the code directly.
llvm-svn: 150624
2012-02-15 22:36:15 +00:00
Bill Wendling
493a72b2fe
Add code to the target lowering object file module to handle module flags.
...
The MachO back-end needs to emit the garbage collection flags specified in the
module flags. This is a WIP, so the front-end hasn't been modified to emit these
flags just yet. Documentation and front-end switching to occur soon.
llvm-svn: 150507
2012-02-14 21:28:13 +00:00
Anton Korobeynikov
5996573d4b
Add support for implicit TLS model used with MS VC runtime.
...
Patch by Kai Nacke!
llvm-svn: 150307
2012-02-11 17:26:53 +00:00
Anton Korobeynikov
682b2821ce
Properly emit ctors / dtors with priorities into desired sections
...
and let linker handle the rest.
This finally fixes PR5329
llvm-svn: 148990
2012-01-25 22:24:19 +00:00
David Blaikie
06ecc99a56
More dead code removal (using -Wunreachable-code)
...
llvm-svn: 148578
2012-01-20 21:51:11 +00:00
Bill Wendling
0f9a3f91ae
On MachO, the pointer to the personality function should always be in the
...
non_lazy_symbol_pointers section (__IMPORT,__pointers). Ignore the 'hidden' part
since that will place it in the wrong section.
<rdar://problem/10443720>
llvm-svn: 145356
2011-11-29 01:43:20 +00:00
Benjamin Kramer
a2f57dee6d
Remove all remaining uses of Value::getNameStr().
...
llvm-svn: 144648
2011-11-15 16:27:03 +00:00
Bill Wendling
e37d737f13
Check the visibility of the global variable before placing it into the stubs
...
table. A hidden variable could potentially end up in both lists.
<rdar://problem/10336715>
llvm-svn: 142869
2011-10-24 23:05:43 +00:00
Evan Cheng
c9bc5a9011
Goodbye TargetAsmInfo. This eliminate last bit of CodeGen and Target in llvm-mc.
...
There is still a bit more refactoring left to do in Targets. But we are now very
close to fixing all the layering issues in MC.
llvm-svn: 135611
2011-07-20 19:50:42 +00:00
Evan Cheng
380dc98371
Add MCObjectFileInfo and sink the MCSections initialization code from
...
TargetLoweringObjectFileImpl down to MCObjectFileInfo.
TargetAsmInfo is done to one last method. It's *almost* gone!
llvm-svn: 135569
2011-07-20 05:58:47 +00:00
Evan Cheng
9a80b0a7e6
Fix an obvious typo that's preventing x86 (32-bit) from using .literal16.
...
llvm-svn: 135535
2011-07-19 23:14:32 +00:00
Evan Cheng
7bdc771798
Fix up TargetLoweringObjectFile ctors to properly initialize fields.
...
llvm-svn: 135068
2011-07-13 19:54:59 +00:00
Bill Wendling
42866c8944
Use the presence of the __compact_unwind section to indicate that a target
...
supports compact unwind info instead of having a separate flag indicating this.
llvm-svn: 133685
2011-06-23 05:13:28 +00:00
Bill Wendling
ec779bc283
Add a flag that indicates whether a target supports compact unwind info or not.
...
llvm-svn: 133662
2011-06-22 23:16:51 +00:00
Bill Wendling
72c8521466
Add a __LD,__compact_unwind section.
...
If the linker supports it, this will hold the CIE and FDE information in a
compact format. The implementation of the compact unwinding emission is coming
soon.
llvm-svn: 133658
2011-06-22 22:22:24 +00:00
Rafael Espindola
36459b9b7f
Fix invalid uses of Twine. Hopefully this fixes the problem that Takumi is
...
having.
llvm-svn: 132898
2011-06-13 03:09:13 +00:00
Rafael Espindola
12efa298a0
Fix a silly error I introduce in r131951.
...
Fixes PR10095.
llvm-svn: 132735
2011-06-07 23:26:45 +00:00
Charles Davis
cb20ea9935
Add the suffix to the Win64 EH data sections' names if given. Add a test for
...
this. XFAIL'd, because the COFF AsmParser can't handle .section yet.
llvm-svn: 132220
2011-05-27 21:38:47 +00:00
Charles Davis
4becdc727e
Revert r132111. I built Release (without Asserts), so I didn't know about the
...
assert that prevented setting alignment on section creation.
llvm-svn: 132113
2011-05-26 05:35:55 +00:00
Charles Davis
44fb280873
Align Win64 EH Table sections to 4 bytes.
...
llvm-svn: 132111
2011-05-26 05:19:54 +00:00
Rafael Espindola
8e44a53856
Explain FIXME.
...
llvm-svn: 131952
2011-05-24 03:10:31 +00:00
Rafael Espindola
176fe6a0e0
Fix the defaults for .eh_frame. We were marking it as writable.
...
llvm-svn: 131951
2011-05-24 02:50:20 +00:00
Charles Davis
445c467ced
Fix typo. When will I learn?
...
llvm-svn: 131765
2011-05-20 22:23:34 +00:00
Charles Davis
989cc73ef3
Add .pdata and .xdata sections to the COFF TLOF implementation.
...
llvm-svn: 131763
2011-05-20 22:13:55 +00:00
Bill Wendling
7a13f3bde3
Remove a flag that would set the ".eh" symbol as .globl. MachO was the only one
...
who used this flag, and it now emits CFI and doesn't emit this anymore. All
other targets left this flag "false".
<rdar://problem/8486371>
llvm-svn: 130918
2011-05-05 06:49:15 +00:00
Rafael Espindola
eb5d0cb4f4
GCC uses a different encoding of pointers in the FDE when using
...
-fno-dwarf2-cfi-asm. Implement the same behavior.
llvm-svn: 130637
2011-05-01 04:49:54 +00:00
Rafael Espindola
36e419b524
Remove unnecessary argument.
...
llvm-svn: 130343
2011-04-27 23:17:57 +00:00
Rafael Espindola
0525497a16
Rename getPersonalityPICSymbol to getCFIPersonalitySymbol, document it, and
...
give it a bit more responsibility. Also implement it for MachO.
If hacked to use cfi, 32 bit MachO will produce
.cfi_personality 155, L___gxx_personality_v0$non_lazy_ptr
and 64 bit will produce
.cfi_presonality ___gxx_personality_v0
The general idea is that .cfi_personality gets passed the final symbol. It is
up to codegen to produce it if using indirect representation (like 32 bit
MachO), but it is up to MC to decide which relocations to create.
llvm-svn: 130341
2011-04-27 23:08:15 +00:00
Rafael Espindola
6bf5acb38d
Fix indentation.
...
llvm-svn: 130331
2011-04-27 21:29:52 +00:00
Rafael Espindola
09e9797728
Remove unused arguments.
...
llvm-svn: 129844
2011-04-20 03:08:09 +00:00
Daniel Dunbar
82a4062a4e
ADT/Triple: Renambe isOSX... methods to isMacOSX for consistency with the OS
...
triple component.
llvm-svn: 129838
2011-04-20 00:14:25 +00:00
Daniel Dunbar
140e365c49
CodeGen: Eliminate a use of getDarwinMajorNumber().
...
- There is a minor semantic change here (evidenced by the test change) for
Darwin triples that have no version component. I debated changing the default
behavior of isOSVersionLT, but decided it made more sense for triples to be
explicit.
llvm-svn: 129802
2011-04-19 20:32:39 +00:00
Rafael Espindola
9e5aaa3b78
Put each personality function in a section. This fixes the gnu ld warning:
...
error in foo.o; no .eh_frame_hdr table will be created.
llvm-svn: 129635
2011-04-16 03:51:21 +00:00
Stuart Hastings
0c1298989f
Reapply 127939 since Daniel fixed the breakage. <rdar://problem/9012638>
...
llvm-svn: 127944
2011-03-19 02:42:31 +00:00
Stuart Hastings
0b337d0fe8
Revert 127939. <rdar://problem/9012638>
...
llvm-svn: 127943
2011-03-19 02:33:56 +00:00
Stuart Hastings
4a2b1ca9c1
Revise r126127 to address Daniel's comments. <rdar://problem/9012638>
...
llvm-svn: 127939
2011-03-19 01:32:01 +00:00
Rafael Espindola
3a1fd70006
Fix llvm-gcc bootstrap with gnu ld.
...
The problem was codegen guessing the wrong values and printing
.section .eh_frame,"aMS",@progbits,4
It is not clear at all if Codegen should try to guess, MC is the
one that should know the default flags.
llvm-svn: 126421
2011-02-24 20:18:01 +00:00
Eric Christopher
de9e3eaf5f
Revert r125960, it's breaking darwin10 bootstrap.
...
llvm-svn: 126163
2011-02-21 23:52:19 +00:00
Stuart Hastings
d7ca2e5b61
Fix to correctly support attribute((section("__DATA, __common"))).
...
Radar 9012638.
llvm-svn: 126127
2011-02-21 17:27:17 +00:00
Bill Wendling
dd9b7a90a7
Reapply r114997 now that the buildbots have been updated.
...
llvm-svn: 125960
2011-02-18 21:12:58 +00:00
Rafael Espindola
3c32af5834
Switch llvm to using comdats. For now always use groups with a single
...
section.
llvm-svn: 125526
2011-02-14 22:23:49 +00:00
Rafael Espindola
aefd549139
Delay the creation of eh_frame so that the user can change the defaults.
...
Add support for SHT_X86_64_UNWIND.
llvm-svn: 124059
2011-01-23 05:43:40 +00:00
Rafael Espindola
492ad6ca06
Remove more duplicated code.
...
llvm-svn: 124056
2011-01-23 04:43:11 +00:00
Rafael Espindola
59c1246cee
Remove duplicated code.
...
llvm-svn: 124054
2011-01-23 04:28:49 +00:00
Rafael Espindola
0e665e502d
Fixed version of 121434 with no new memory leaks.
...
llvm-svn: 121471
2010-12-10 07:39:47 +00:00
Rafael Espindola
011e168728
Revert my previous patch to make the valgrind bots happy.
...
llvm-svn: 121461
2010-12-10 04:01:09 +00:00
Rafael Espindola
03ad1e8f1f
Initial support for the cfi directives. This is just enough to get
...
f:
.cfi_startproc
nop
.cfi_endproc
assembled (on ELF).
llvm-svn: 121434
2010-12-09 23:48:29 +00:00
Rafael Espindola
3c0f11a265
Fixed version of 118639 with an extra assert to catch similar problems
...
earlier. Implicit bool -> int conversions are evil!
llvm-svn: 118651
2010-11-09 23:42:07 +00:00
Michael J. Spencer
bf82646290
COFF: Add IMAGE_SCN_MEM_READ to text sections.
...
There are currently 100 references to COFF::IMAGE_SCN in 6 files
and 11 different functions. Section to attribute mapping really
needs to happen in one place to avoid problems like this.
llvm-svn: 117473
2010-10-27 18:52:29 +00:00
Michael J. Spencer
fc69783598
Fix whitespace.
...
llvm-svn: 117472
2010-10-27 18:52:20 +00:00
NAKAMURA Takumi
4a85646d6c
lib/CodeGen/TargetLoweringObjectFileImpl.cpp: Tweak to emit ".{section}${name}" instead of ".{section}$linkonce_{name}" for linkonce sections.
...
It seems GNU ld/PECOFF relies on section names, linking with g++'s libstdc++.a would fail.
llvm-svn: 116791
2010-10-19 03:24:42 +00:00
Anton Korobeynikov
c425302670
Do not check that the bodies of two defs of same linkonce global are the same.
...
Such a check does not make any sense in presense of inlining and other compiler-dependent stuff.
This should fix bunch of warnings on mingw32.
llvm-svn: 116113
2010-10-08 21:50:04 +00:00
Bill Wendling
fc29f0d706
Revert r114997. It was causing a failure on darwin10-selfhost.
...
llvm-svn: 115002
2010-09-28 23:11:55 +00:00
Bill Wendling
13775375ed
Fix a FIXME. _foo.eh symbols are currently always exported so that the linker
...
knows about them. This is not necessary on 10.6 and later.
llvm-svn: 114997
2010-09-28 22:36:56 +00:00
Chris Lattner
0ebcc18dec
the latest assembler that runs on powerpc 10.4 machines doesn't
...
support aligned comm. Detect when compiling for 10.4 and don't
emit an alignment for comm. THis will hopefully fix PR8198.
llvm-svn: 114817
2010-09-27 06:44:54 +00:00
Chris Lattner
765e59210c
two changes:
...
1) nuke ConstDataCoalSection, which is dead.
2) revise my previous patch for rdar://8018335,
which was completely wrong. Specifically, it doesn't
make sense to mark __TEXT,__const_coal as PURE_INSTRUCTIONS,
because it is for readonly data. templates (it turns out)
go to const_coal_nt. The real fix for rdar://8018335 was
to give ConstTextCoalSection a section kind of ReadOnly
instead of Text.
llvm-svn: 112496
2010-08-30 18:12:35 +00:00
Chris Lattner
e2f110cba5
fix the definitions of ConstTextCoalSection/ConstDataCoalSection
...
to keep "Text" in sync with the "pure instructions" section attribute.
Lack of this attribute was preventing the assembler from emitting
multibyte noops instructions for templates (and inlines, and other
coalesced stuff) and was causing the assembler to mismatch .o files.
This fixes rdar://8018335
llvm-svn: 108461
2010-07-15 21:22:00 +00:00
Anton Korobeynikov
3097e49515
Fix a major regression on COFF targets introduced by r103267: 'discardable' section means that it is used only during the program load and can be discarded afterwards.
...
This way *only* debug sections can be discarded, but not the opposite. Seems like the copy-and-pasto from ELF code, since there it contains the reverse flag ('alloc').
llvm-svn: 107658
2010-07-06 15:24:56 +00:00
Daniel Dunbar
cc754e66c6
MC: Move COFF enumeration constants to llvm/Support/COFF.h, patch by Michael
...
Spencer!
llvm-svn: 107418
2010-07-01 20:07:24 +00:00
Bill Wendling
59ef9bcc6d
Revert r107205 and r107207.
...
llvm-svn: 107215
2010-06-29 22:34:52 +00:00
Bill Wendling
05a4c0b1f2
Introducing the "linker_weak" linkage type. This will be used for Objective-C
...
metadata types which should be marked as "weak", but which the linker will
remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is
defined like this:
.globl l_objc_msgSend_fixup_alloc
.weak_definition l_objc_msgSend_fixup_alloc
.section __DATA, __objc_msgrefs, coalesced
.align 3
l_objc_msgSend_fixup_alloc:
.quad _objc_msgSend_fixup
.quad L_OBJC_METH_VAR_NAME_1
This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".
llvm-svn: 107205
2010-06-29 21:24:00 +00:00
Eric Christopher
5c5a5be829
Add support for initialized global data for darwin tls. Update comments
...
and testcases accordingly.
llvm-svn: 104635
2010-05-25 21:28:50 +00:00
Eric Christopher
165bcdf8a8
Add full bss data support for darwin tls variables.
...
llvm-svn: 104414
2010-05-22 00:10:22 +00:00
Eric Christopher
6ea9cf8425
More data/parsing support for tls directives. Add a few more testcases
...
and cleanup comments as well.
llvm-svn: 103985
2010-05-17 22:53:55 +00:00
Eric Christopher
380e16a725
Add some section and constant support for darwin TLS.
...
llvm-svn: 103974
2010-05-17 21:02:07 +00:00
Chris Lattner
e72e3e9c12
add COFF support for COMDAT sections, patch by Nathan Jeffords!
...
llvm-svn: 103304
2010-05-07 21:49:09 +00:00
Chris Lattner
c1d0e3a79e
switch MCSectionCOFF from a syntactic to semantic representation,
...
patch by Peter Housel!
llvm-svn: 103267
2010-05-07 17:17:41 +00:00
Chris Lattner
dabcd9738c
add llvm codegen support for -ffunction-sections and -fdata-sections,
...
patch by Sylvere Teissier!
llvm-svn: 101106
2010-04-13 00:36:43 +00:00
Chris Lattner
e154403f78
delete a forwarding function.
...
llvm-svn: 100815
2010-04-08 21:34:17 +00:00
Chris Lattner
1cf4bded13
move elf section uniquing to MCContext. Along the way
...
merge XCore's section into MCSectionELF
llvm-svn: 100812
2010-04-08 21:26:26 +00:00
Chris Lattner
0225dbbfee
remove the TargetLoweringObjectFileMachO::getMachoSection
...
api and update clients to use MCContext instead.
llvm-svn: 100808
2010-04-08 20:40:11 +00:00
Chris Lattner
60ff59e5c1
move macho section uniquing from MCParser and TLOF to MCContext where
...
the compiler and asmparser now unique to the same sections. This fixes
rdar://7835021.
llvm-svn: 100807
2010-04-08 20:30:37 +00:00
Chris Lattner
80b41881bc
rename llvm::llvm_report_error -> llvm::report_fatal_error
...
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Chris Lattner
8e4cf6f425
Rip out the 'is temporary' nonsense from the MCContext interface to
...
create symbols. It is extremely error prone and a source of a lot
of the remaining integrated assembler bugs on x86-64.
This fixes rdar://7807601.
llvm-svn: 99902
2010-03-30 18:10:53 +00:00
Bill Wendling
5493cf6715
Now that the default for Darwin platforms is to place the LSDA into the TEXT
...
section, remove the target-specific code that performs this.
llvm-svn: 98580
2010-03-15 21:09:38 +00:00
Chris Lattner
0ae3e35f22
use Mang->getSymbol() more.
...
llvm-svn: 98577
2010-03-15 20:37:38 +00:00
Chris Lattner
b24982ba65
fix MCSectionELF to not leak memory, just like I did for MCSymbol.
...
MCSectionMachO is already fine (yay for fixed size arrays?),
MCSectionCOFF still leaks.
llvm-svn: 98537
2010-03-15 06:23:52 +00:00
Chris Lattner
5aefaeb42e
fix a fixme in TargetLoweringObjectFile::getExprForDwarfReference
...
where we used ot create an MCSymbol for ".". Now emit an assembler
temporary label and reference it instead of "." textually.
rdar://7739457
llvm-svn: 98292
2010-03-11 21:55:20 +00:00
Chris Lattner
1ce9dfd498
rename getSymbolForDwarf* to getExprForDwarf* since it returns
...
an MCExpr and not an MCSymbol. Change it to take an MCStreamer,
which is currently unused.
No functionality change.
llvm-svn: 98278
2010-03-11 19:41:58 +00:00
Bill Wendling
df325dee9d
Add a bit along with the MCSymbols stored in the MachineModuleInfo maps that
...
indicates that an MCSymbol is external or not. (It's true if it's external.)
This will be used to specify the correct information to add to non-lazy
pointers. That will be explained further when this bit is used.
llvm-svn: 98199
2010-03-10 22:34:10 +00:00
Chris Lattner
e34dde1e83
move three lowering hooks from MAI to TLOF and make one of them
...
semantic instead of syntactic. This completes MCization of
darwin/x86[-64]!
llvm-svn: 98145
2010-03-10 07:20:42 +00:00
Chris Lattner
ed0b8d36e4
set the temporary bit on MCSymbols correctly.
...
llvm-svn: 98124
2010-03-10 02:25:11 +00:00
Chris Lattner
6dbe3336f9
tidy up
...
llvm-svn: 97895
2010-03-07 04:28:09 +00:00
Charles Davis
faa2f44081
Don't emit global symbols into the (__TEXT,__ustring) section on Darwin. This
...
is a workaround for <rdar://problem/7672401/> (which I filed).
This let's us build Wine on Darwin, and it gets the Qt build there a little bit
further (so Doug says).
llvm-svn: 97845
2010-03-05 22:28:45 +00:00
Bill Wendling
f0bd51c4e3
Revert...
...
--- Reverse-merging r97592 into '.':
U lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm-svn: 97657
2010-03-03 19:31:05 +00:00
Bill Wendling
1ad5825d64
Okay. One last attempt:
...
Place the LSDA into the TEXT section on Mach-O. This saves space.
llvm-svn: 97592
2010-03-02 21:50:35 +00:00
Bill Wendling
eb07770194
The TType is always absptr on Mach-O...at least for now.
...
llvm-svn: 97295
2010-02-27 01:05:51 +00:00
Anton Korobeynikov
0b402e1a61
It turned out that we failed to emit proper symbol stubs on non-x86/darwin for ages (we emitted a reference to a stub, but no stub was emitted). The code inside x86-32/macho target objfile lowering should actually be the generic one - move it there.
...
This (I really, really hope) should fix EH issues on ppc/darwin
and arm/darwin.
llvm-svn: 96755
2010-02-21 20:28:15 +00:00
Bob Wilson
c03fbf812d
Revert Anton's most recent EH patch (r96637), since it breaks a lot of
...
ARM and Thumb tests.
llvm-svn: 96680
2010-02-19 17:10:59 +00:00
Anton Korobeynikov
8aaa04a614
Use the same encoding for EH stuff uniformly on all MachO targets.
...
This hopefulyl should unbreak EH on PPC/Darwin.
llvm-svn: 96637
2010-02-19 00:29:36 +00:00
Anton Korobeynikov
ef1862e256
Move TLOF implementations to libCodegen to resolve layering violation.
...
llvm-svn: 96288
2010-02-15 22:37:53 +00:00