diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-16 18:23:53 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-16 18:23:53 +0000 |
commit | f230df9af4012f9510de664b6d62b128e26a5861 (patch) | |
tree | 459a596099278874a963dabafad21e27da5046eb /lib/MC/MCObjectFormat.cpp | |
parent | cb2caf738023c0a03f5df1b909431129a16e2c54 (diff) | |
download | external_llvm-f230df9af4012f9510de664b6d62b128e26a5861.zip external_llvm-f230df9af4012f9510de664b6d62b128e26a5861.tar.gz external_llvm-f230df9af4012f9510de664b6d62b128e26a5861.tar.bz2 |
Add a MCObjectFormat class so that code common to all targets that use a
single object format can be shared.
This also adds support for
mov zed+(bar-foo), %eax
on ELF and COFF targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCObjectFormat.cpp')
-rw-r--r-- | lib/MC/MCObjectFormat.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/MC/MCObjectFormat.cpp b/lib/MC/MCObjectFormat.cpp new file mode 100644 index 0000000..07d361c --- /dev/null +++ b/lib/MC/MCObjectFormat.cpp @@ -0,0 +1,31 @@ +//===- 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; + +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(); +} |