summaryrefslogtreecommitdiff
path: root/lib/MC/MCObjectFormat.cpp
blob: aeff3347187f93b387f538f52cb21288ebd6a81a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//===- lib/MC/MCObjectFormat.cpp - MCObjectFormat implementation ----------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "llvm/MC/MCObjectFormat.h"
#include "llvm/MC/MCSymbol.h"

using namespace llvm;

MCObjectFormat::~MCObjectFormat() {
}

bool MCELFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
                                   const MCSymbol &B) const {
  // On ELF A - B is absolute if A and B are in the same section.
  return &A.getSection() == &B.getSection();
}

bool MCMachOObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
                                     const MCSymbol &B) const  {
  // On MachO A - B is absolute only if in a set.
  return IsSet;
}

bool MCCOFFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
                                    const MCSymbol &B) const  {
  // On COFF A - B is absolute if A and B are in the same section.
  return &A.getSection() == &B.getSection();
}