aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-11-27 06:44:18 +0000
committerBill Wendling <isanbard@gmail.com>2013-11-27 06:44:18 +0000
commit0ae07098f7d2ad5a1868d448d0b1b4eef2a3b091 (patch)
treee8e00fbae3c35abdbcfe8f7aacd1df44a0fe00b7 /include
parentb1df5b013a38ab7381630af8b3142c56f604d85b (diff)
downloadexternal_llvm-0ae07098f7d2ad5a1868d448d0b1b4eef2a3b091.zip
external_llvm-0ae07098f7d2ad5a1868d448d0b1b4eef2a3b091.tar.gz
external_llvm-0ae07098f7d2ad5a1868d448d0b1b4eef2a3b091.tar.bz2
Merging r195148:
------------------------------------------------------------------------ r195148 | rafael | 2013-11-19 11:52:52 -0800 (Tue, 19 Nov 2013) | 15 lines Support multiple COFF sections with the same name but different COMDAT. This is the first step to fix pr17918. It extends the .section directive a bit, inspired by what the ELF one looks like. The problem with using linkonce is that given .section foo .linkonce.... .section foo .linkonce we would already have switched sections when getting to .linkonce. The cleanest solution seems to be to add the comdat information in the .section itself. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@195822 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCContext.h8
-rw-r--r--include/llvm/MC/MCSectionCOFF.h14
2 files changed, 18 insertions, 4 deletions
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index 8fba18c..c8b6626 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -258,9 +258,15 @@ namespace llvm {
const MCSectionCOFF *getCOFFSection(StringRef Section,
unsigned Characteristics,
- SectionKind Kind, int Selection = 0,
+ SectionKind Kind,
+ StringRef COMDATSymName,
+ int Selection,
const MCSectionCOFF *Assoc = 0);
+ const MCSectionCOFF *getCOFFSection(StringRef Section,
+ unsigned Characteristics,
+ SectionKind Kind);
+
const MCSectionCOFF *getCOFFSection(StringRef Section);
/// @}
diff --git a/include/llvm/MC/MCSectionCOFF.h b/include/llvm/MC/MCSectionCOFF.h
index 754e829..45c84ae 100644
--- a/include/llvm/MC/MCSectionCOFF.h
+++ b/include/llvm/MC/MCSectionCOFF.h
@@ -19,6 +19,7 @@
#include "llvm/Support/COFF.h"
namespace llvm {
+class MCSymbol;
/// MCSectionCOFF - This represents a section on Windows
class MCSectionCOFF : public MCSection {
@@ -32,6 +33,11 @@ namespace llvm {
/// drawn from the enums below.
mutable unsigned Characteristics;
+ /// The COMDAT symbol of this section. Only valid if this is a COMDAT
+ /// section. Two COMDAT sections are merged if they have the same
+ /// COMDAT symbol.
+ const MCSymbol *COMDATSymbol;
+
/// Selection - This is the Selection field for the section symbol, if
/// it is a COMDAT section (Characteristics & IMAGE_SCN_LNK_COMDAT) != 0
mutable int Selection;
@@ -44,9 +50,11 @@ namespace llvm {
private:
friend class MCContext;
MCSectionCOFF(StringRef Section, unsigned Characteristics,
- int Selection, const MCSectionCOFF *Assoc, SectionKind K)
- : MCSection(SV_COFF, K), SectionName(Section),
- Characteristics(Characteristics), Selection(Selection), Assoc(Assoc) {
+ const MCSymbol *COMDATSymbol, int Selection,
+ const MCSectionCOFF *Assoc, SectionKind K)
+ : MCSection(SV_COFF, K), SectionName(Section),
+ Characteristics(Characteristics), COMDATSymbol(COMDATSymbol),
+ Selection(Selection), Assoc(Assoc) {
assert ((Characteristics & 0x00F00000) == 0 &&
"alignment must not be set upon section creation");
assert ((Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) ==