summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2019-03-28 17:05:09 +0000
committerRui Ueyama <ruiu@google.com>2019-03-28 17:05:09 +0000
commitc694633a12af1312fcafd73d4de57ae40f696595 (patch)
treebe172363f9fd8341c8ea1ed3c1de047629ffaee0
parent155e26f0f43c92131d624fe5e0db4b3cb010cf96 (diff)
downloadbcm5719-llvm-c694633a12af1312fcafd73d4de57ae40f696595.tar.gz
bcm5719-llvm-c694633a12af1312fcafd73d4de57ae40f696595.zip
Make TargetInfo const. NFC.
We do not mutate a TargetInfo instance after creating it. This change makes it explicit. llvm-svn: 357185
-rw-r--r--lld/ELF/Target.cpp4
-rw-r--r--lld/ELF/Target.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index 66f438cdd09..2e4dd526687 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -37,7 +37,7 @@ using namespace llvm::ELF;
using namespace lld;
using namespace lld::elf;
-TargetInfo *elf::Target;
+const TargetInfo *elf::Target;
std::string lld::toString(RelType Type) {
StringRef S = getELFRelocationTypeName(elf::Config->EMachine, Type);
@@ -175,7 +175,7 @@ void TargetInfo::relaxTlsLdToLe(uint8_t *Loc, RelType Type,
llvm_unreachable("Should not have claimed to be relaxable");
}
-uint64_t TargetInfo::getImageBase() {
+uint64_t TargetInfo::getImageBase() const {
// Use -image-base if set. Fall back to the target default if not.
if (Config->ImageBase)
return *Config->ImageBase;
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index 5f5f7b570ed..8921a8e0d36 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -84,7 +84,7 @@ public:
unsigned PageSize = 4096;
unsigned DefaultMaxPageSize = 4096;
- uint64_t getImageBase();
+ uint64_t getImageBase() const;
// Offset of _GLOBAL_OFFSET_TABLE_ from base of .got or .got.plt section.
uint64_t GotBaseSymOff = 0;
@@ -183,7 +183,7 @@ bool isPPC64SmallCodeModelTocReloc(RelType Type);
uint64_t getPPC64TocBase();
uint64_t getAArch64Page(uint64_t Expr);
-extern TargetInfo *Target;
+extern const TargetInfo *Target;
TargetInfo *getTarget();
template <class ELFT> bool isMipsPIC(const Defined *Sym);
OpenPOWER on IntegriCloud