[lld] r199164 - Whitespace.
Rui Ueyama
ruiu at google.com
Mon Jan 13 15:21:33 PST 2014
Author: ruiu
Date: Mon Jan 13 17:21:33 2014
New Revision: 199164
URL: http://llvm.org/viewvc/llvm-project?rev=199164&view=rev
Log:
Whitespace.
Modified:
lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp
lld/trunk/unittests/MachOTests/MachONormalizedFileToAtomsTests.cpp
lld/trunk/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp
Modified: lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp?rev=199164&r1=199163&r2=199164&view=diff
==============================================================================
--- lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp (original)
+++ lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryReaderTests.cpp Mon Jan 13 17:21:33 2014
@@ -22,12 +22,12 @@ using llvm::ErrorOr;
using namespace lld::mach_o::normalized;
using namespace llvm::MachO;
-static std::unique_ptr<NormalizedFile>
+static std::unique_ptr<NormalizedFile>
fromBinary(const uint8_t bytes[], unsigned length) {
StringRef sr((const char*)bytes, length);
std::unique_ptr<MemoryBuffer> mb(MemoryBuffer::getMemBuffer(sr, "", false));
- ErrorOr<std::unique_ptr<NormalizedFile>> r
+ ErrorOr<std::unique_ptr<NormalizedFile>> r
= lld::mach_o::normalized::readBinary(mb);
EXPECT_FALSE(!r);
return std::move(*r);
@@ -36,29 +36,29 @@ fromBinary(const uint8_t bytes[], unsign
TEST(BinaryReaderTest, empty_obj_x86_64) {
const uint8_t fileBytes[] = {
- 0xcf, 0xfa, 0xed, 0xfe, 0x07, 0x00, 0x00, 0x01,
+ 0xcf, 0xfa, 0xed, 0xfe, 0x07, 0x00, 0x00, 0x01,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x19, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
+ 0x19, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5f, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5f, 0x5f, 0x54, 0x45, 0x58, 0x54, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
std::unique_ptr<NormalizedFile> f = fromBinary(fileBytes, sizeof(fileBytes));
EXPECT_EQ(f->arch, lld::MachOLinkingContext::arch_x86_64);
EXPECT_EQ((int)(f->fileType), MH_OBJECT);
@@ -230,7 +230,7 @@ TEST(BinaryReaderTest, hello_obj_x86_64)
0x74, 0x66, 0x00, 0x4C, 0x5F, 0x2E, 0x73, 0x74,
0x72, 0x00, 0x00, 0x00 };
std::unique_ptr<NormalizedFile> f = fromBinary(fileBytes, sizeof(fileBytes));
-
+
EXPECT_EQ(f->arch, lld::MachOLinkingContext::arch_x86_64);
EXPECT_EQ((int)(f->fileType), MH_OBJECT);
EXPECT_EQ((int)(f->flags), MH_SUBSECTIONS_VIA_SYMBOLS);
@@ -239,7 +239,7 @@ TEST(BinaryReaderTest, hello_obj_x86_64)
EXPECT_TRUE(text.segmentName.equals("__TEXT"));
EXPECT_TRUE(text.sectionName.equals("__text"));
EXPECT_EQ(text.type, S_REGULAR);
- EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(text.alignment, 4U);
EXPECT_EQ(text.address, Hex64(0x0));
@@ -260,7 +260,7 @@ TEST(BinaryReaderTest, hello_obj_x86_64)
EXPECT_EQ(str.length, 2);
EXPECT_EQ(str.isExtern, true);
EXPECT_EQ(str.symbol, 0U);
-
+
const Section& cstring = f->sections[1];
EXPECT_TRUE(cstring.segmentName.equals("__TEXT"));
EXPECT_TRUE(cstring.sectionName.equals("__cstring"));
@@ -355,7 +355,7 @@ TEST(BinaryReaderTest, hello_obj_x86) {
0x74, 0x66, 0x00, 0x00
};
std::unique_ptr<NormalizedFile> f = fromBinary(fileBytes, sizeof(fileBytes));
-
+
EXPECT_EQ(f->arch, lld::MachOLinkingContext::arch_x86);
EXPECT_EQ((int)(f->fileType), MH_OBJECT);
EXPECT_EQ((int)(f->flags), MH_SUBSECTIONS_VIA_SYMBOLS);
@@ -364,7 +364,7 @@ TEST(BinaryReaderTest, hello_obj_x86) {
EXPECT_TRUE(text.segmentName.equals("__TEXT"));
EXPECT_TRUE(text.sectionName.equals("__text"));
EXPECT_EQ(text.type, S_REGULAR);
- EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(text.alignment, 4U);
EXPECT_EQ(text.address, Hex64(0x0));
@@ -395,7 +395,7 @@ TEST(BinaryReaderTest, hello_obj_x86) {
EXPECT_EQ(pair.pcRel, false);
EXPECT_EQ(pair.length, 2);
EXPECT_EQ(pair.value, 0x0BU);
-
+
const Section& cstring = f->sections[1];
EXPECT_TRUE(cstring.segmentName.equals("__TEXT"));
EXPECT_TRUE(cstring.sectionName.equals("__cstring"));
@@ -487,7 +487,7 @@ TEST(BinaryReaderTest, hello_obj_armv7)
0x70, 0x72, 0x69, 0x6E, 0x74, 0x66, 0x00, 0x00
};
std::unique_ptr<NormalizedFile> f = fromBinary(fileBytes, sizeof(fileBytes));
-
+
EXPECT_EQ(f->arch, lld::MachOLinkingContext::arch_armv7);
EXPECT_EQ((int)(f->fileType), MH_OBJECT);
EXPECT_EQ((int)(f->flags), MH_SUBSECTIONS_VIA_SYMBOLS);
@@ -496,7 +496,7 @@ TEST(BinaryReaderTest, hello_obj_armv7)
EXPECT_TRUE(text.segmentName.equals("__TEXT"));
EXPECT_TRUE(text.sectionName.equals("__text"));
EXPECT_EQ(text.type, S_REGULAR);
- EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(text.alignment, 2U);
EXPECT_EQ(text.address, Hex64(0x0));
@@ -536,7 +536,7 @@ TEST(BinaryReaderTest, hello_obj_armv7)
EXPECT_EQ(movwPair.type, ARM_RELOC_PAIR);
EXPECT_EQ(movwPair.length, 2);
EXPECT_EQ(movwPair.value, Hex32(0xE));
-
+
const Section& cstring = f->sections[1];
EXPECT_TRUE(cstring.segmentName.equals("__TEXT"));
EXPECT_TRUE(cstring.sectionName.equals("__cstring"));
@@ -631,7 +631,7 @@ TEST(BinaryReaderTest, hello_obj_ppc) {
0x70, 0x72, 0x69, 0x6E, 0x74, 0x66, 0x00, 0x00
};
std::unique_ptr<NormalizedFile> f = fromBinary(fileBytes, sizeof(fileBytes));
-
+
EXPECT_EQ(f->arch, lld::MachOLinkingContext::arch_ppc);
EXPECT_EQ((int)(f->fileType), MH_OBJECT);
EXPECT_EQ((int)(f->flags), MH_SUBSECTIONS_VIA_SYMBOLS);
@@ -640,7 +640,7 @@ TEST(BinaryReaderTest, hello_obj_ppc) {
EXPECT_TRUE(text.segmentName.equals("__TEXT"));
EXPECT_TRUE(text.sectionName.equals("__text"));
EXPECT_EQ(text.type, S_REGULAR);
- EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(text.alignment, 2U);
EXPECT_EQ(text.address, Hex64(0x0));
@@ -679,7 +679,7 @@ TEST(BinaryReaderTest, hello_obj_ppc) {
EXPECT_EQ(haPair.type, PPC_RELOC_PAIR);
EXPECT_EQ(haPair.length, 2);
EXPECT_EQ(haPair.value, Hex32(0x18));
-
+
const Section& cstring = f->sections[1];
EXPECT_TRUE(cstring.segmentName.equals("__TEXT"));
EXPECT_TRUE(cstring.sectionName.equals("__cstring"));
@@ -693,7 +693,7 @@ TEST(BinaryReaderTest, hello_obj_ppc) {
EXPECT_EQ((int)(cstring.content[2]), 0x6c);
EXPECT_TRUE(cstring.indirectSymbols.empty());
EXPECT_TRUE(cstring.relocations.empty());
-
+
EXPECT_EQ(f->localSymbols.size(), 0UL);
EXPECT_EQ(f->globalSymbols.size(), 1UL);
const Symbol& mainLabel = f->globalSymbols[0];
@@ -707,7 +707,7 @@ TEST(BinaryReaderTest, hello_obj_ppc) {
EXPECT_TRUE(printfLabel.name.equals("_printf"));
EXPECT_EQ(printfLabel.type, N_UNDF);
EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT));
-
+
writeBinary(*f, "/tmp/foo.o");
}
Modified: lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp?rev=199164&r1=199163&r2=199164&view=diff
==============================================================================
--- lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp (original)
+++ lld/trunk/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp Mon Jan 13 17:21:33 2014
@@ -32,8 +32,8 @@ using namespace lld::mach_o::normalized;
// Parses binary mach-o file at specified path and returns
// ownership of buffer to mb parameter and ownership of
// Normalized file to nf parameter.
-static void
-fromBinary(StringRef path, std::unique_ptr<MemoryBuffer> &mb,
+static void
+fromBinary(StringRef path, std::unique_ptr<MemoryBuffer> &mb,
std::unique_ptr<NormalizedFile> &nf) {
OwningPtr<MemoryBuffer> opmb;
@@ -41,15 +41,15 @@ fromBinary(StringRef path, std::unique_p
EXPECT_FALSE(ec);
mb.reset(opmb.take());
- ErrorOr<std::unique_ptr<NormalizedFile>> r
+ ErrorOr<std::unique_ptr<NormalizedFile>> r
= lld::mach_o::normalized::readBinary(mb);
EXPECT_FALSE(!r);
nf.reset(r->release());
}
-static Relocation
-makeReloc(unsigned addr, bool rel, bool ext, RelocationInfoType type,
+static Relocation
+makeReloc(unsigned addr, bool rel, bool ext, RelocationInfoType type,
unsigned sym) {
Relocation result;
result.offset = addr;
@@ -63,7 +63,7 @@ makeReloc(unsigned addr, bool rel, bool
return result;
}
-static Relocation
+static Relocation
makeScatReloc(unsigned addr, RelocationInfoType type, unsigned value) {
Relocation result;
result.offset = addr;
@@ -77,7 +77,7 @@ makeScatReloc(unsigned addr, RelocationI
return result;
}
-static Symbol
+static Symbol
makeUndefSymbol(StringRef name) {
Symbol sym;
sym.name = name;
@@ -90,7 +90,7 @@ makeUndefSymbol(StringRef name) {
}
-static Symbol
+static Symbol
makeSymbol(StringRef name, unsigned addr) {
Symbol sym;
sym.name = name;
@@ -102,7 +102,7 @@ makeSymbol(StringRef name, unsigned addr
return sym;
}
-static Symbol
+static Symbol
makeThumbSymbol(StringRef name, unsigned addr) {
Symbol sym;
sym.name = name;
@@ -127,16 +127,16 @@ TEST(BinaryWriterTest, obj_relocs_x86_64
text.segmentName = "__TEXT";
text.sectionName = "__text";
text.type = S_REGULAR;
- text.attributes = SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ text.attributes = SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS);
text.alignment = 4;
text.address = 0;
const uint8_t textBytes[] = {
- 0xe8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x05,
- 0x00, 0x00, 0x00, 0x00, 0xff, 0x35, 0x00, 0x00,
- 0x00, 0x00, 0x8b, 0x05, 0x00, 0x00, 0x00, 0x00,
- 0xc6, 0x05, 0xff, 0xff, 0xff, 0xff, 0x12, 0xc7,
- 0x05, 0xfc, 0xff, 0xff, 0xff, 0x78, 0x56, 0x34,
+ 0xe8, 0x00, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x05,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0x35, 0x00, 0x00,
+ 0x00, 0x00, 0x8b, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0xc6, 0x05, 0xff, 0xff, 0xff, 0xff, 0x12, 0xc7,
+ 0x05, 0xfc, 0xff, 0xff, 0xff, 0x78, 0x56, 0x34,
0x12, 0x48, 0x8b, 0x3d, 0x00, 0x00, 0x00, 0x00 };
text.content = llvm::makeArrayRef(textBytes, sizeof(textBytes));
@@ -147,16 +147,16 @@ TEST(BinaryWriterTest, obj_relocs_x86_64
text.relocations.push_back(makeReloc(0x1A, false, true, X86_64_RELOC_SIGNED_1, 1));
text.relocations.push_back(makeReloc(0x21, false, true, X86_64_RELOC_SIGNED_4, 1));
text.relocations.push_back(makeReloc(0x2C, false, true, X86_64_RELOC_TLV, 2));
-
+
f.undefinedSymbols.push_back(makeUndefSymbol("_bar"));
f.undefinedSymbols.push_back(makeUndefSymbol("_tbar"));
-
+
error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
EXPECT_FALSE(ec);
ec = writeBinary(f, tmpFl);
EXPECT_FALSE(ec);
}
-
+
std::unique_ptr<MemoryBuffer> bufferOwner;
std::unique_ptr<NormalizedFile> f2;
fromBinary(tmpFl, bufferOwner, f2);
@@ -164,7 +164,7 @@ TEST(BinaryWriterTest, obj_relocs_x86_64
EXPECT_EQ(lld::MachOLinkingContext::arch_x86_64, f2->arch);
EXPECT_EQ(MH_OBJECT, f2->fileType);
EXPECT_EQ(FileFlags(MH_SUBSECTIONS_VIA_SYMBOLS), f2->flags);
-
+
EXPECT_TRUE(f2->localSymbols.empty());
EXPECT_TRUE(f2->globalSymbols.empty());
EXPECT_EQ(2UL, f2->undefinedSymbols.size());
@@ -176,13 +176,13 @@ TEST(BinaryWriterTest, obj_relocs_x86_64
EXPECT_TRUE(tbarUndef.name.equals("_tbar"));
EXPECT_EQ(N_UNDF, tbarUndef.type);
EXPECT_EQ(SymbolScope(N_EXT), tbarUndef.scope);
-
+
EXPECT_EQ(1UL, f2->sections.size());
const Section& text = f2->sections[0];
EXPECT_TRUE(text.segmentName.equals("__TEXT"));
EXPECT_TRUE(text.sectionName.equals("__text"));
EXPECT_EQ(S_REGULAR, text.type);
- EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(text.alignment, 4U);
EXPECT_EQ(text.address, Hex64(0x0));
@@ -223,7 +223,7 @@ TEST(BinaryWriterTest, obj_relocs_x86_64
EXPECT_EQ(signed4.length, 2);
EXPECT_EQ(signed4.isExtern, true);
EXPECT_EQ(signed4.symbol, 1U);
-
+
error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
EXPECT_FALSE(ec);
}
@@ -243,7 +243,7 @@ TEST(BinaryWriterTest, obj_relocs_x86) {
text.segmentName = "__TEXT";
text.sectionName = "__text";
text.type = S_REGULAR;
- text.attributes = SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ text.attributes = SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS);
text.alignment = 4;
text.address = 0;
@@ -258,10 +258,10 @@ TEST(BinaryWriterTest, obj_relocs_x86) {
text.relocations.push_back(makeScatReloc(0x0c, GENERIC_RELOC_LOCAL_SECTDIFF, 0));
text.relocations.push_back(makeScatReloc(0x0, GENERIC_RELOC_PAIR, 5));
text.relocations.push_back(makeReloc(0x12, true, true, GENERIC_RELOC_TLV, 1));
-
+
f.undefinedSymbols.push_back(makeUndefSymbol("_bar"));
f.undefinedSymbols.push_back(makeUndefSymbol("_tbar"));
-
+
error_code ec = llvm::sys::fs::createTemporaryFile(Twine("xx"), "o", tmpFl);
EXPECT_FALSE(ec);
ec = writeBinary(f, tmpFl);
@@ -274,7 +274,7 @@ TEST(BinaryWriterTest, obj_relocs_x86) {
EXPECT_EQ(lld::MachOLinkingContext::arch_x86, f2->arch);
EXPECT_EQ(MH_OBJECT, f2->fileType);
EXPECT_EQ(FileFlags(MH_SUBSECTIONS_VIA_SYMBOLS), f2->flags);
-
+
EXPECT_TRUE(f2->localSymbols.empty());
EXPECT_TRUE(f2->globalSymbols.empty());
EXPECT_EQ(2UL, f2->undefinedSymbols.size());
@@ -286,13 +286,13 @@ TEST(BinaryWriterTest, obj_relocs_x86) {
EXPECT_TRUE(tbarUndef.name.equals("_tbar"));
EXPECT_EQ(N_UNDF, tbarUndef.type);
EXPECT_EQ(SymbolScope(N_EXT), tbarUndef.scope);
-
+
EXPECT_EQ(1UL, f2->sections.size());
const Section& text = f2->sections[0];
EXPECT_TRUE(text.segmentName.equals("__TEXT"));
EXPECT_TRUE(text.sectionName.equals("__text"));
EXPECT_EQ(S_REGULAR, text.type);
- EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(text.alignment, 4U);
EXPECT_EQ(text.address, Hex64(0x0));
@@ -331,7 +331,7 @@ TEST(BinaryWriterTest, obj_relocs_x86) {
EXPECT_EQ(tlv.length, 2);
EXPECT_EQ(tlv.isExtern, true);
EXPECT_EQ(tlv.symbol, 1U);
-
+
//llvm::errs() << "temp = " << tmpFl << "\n";
error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
EXPECT_FALSE(ec);
@@ -352,29 +352,29 @@ TEST(BinaryWriterTest, obj_relocs_armv7)
text.segmentName = "__TEXT";
text.sectionName = "__text";
text.type = S_REGULAR;
- text.attributes = SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ text.attributes = SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS);
text.alignment = 2;
text.address = 0;
const uint8_t textBytes[] = {
- 0xff, 0xf7, 0xfe, 0xef, 0x40, 0xf2, 0x05, 0x01,
+ 0xff, 0xf7, 0xfe, 0xef, 0x40, 0xf2, 0x05, 0x01,
0xc0, 0xf2, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0xbf };
text.content = llvm::makeArrayRef(textBytes, sizeof(textBytes));
- text.relocations.push_back(makeReloc(0x00, true, true,
+ text.relocations.push_back(makeReloc(0x00, true, true,
ARM_THUMB_RELOC_BR22, 2));
- text.relocations.push_back(makeScatReloc(0x04,
+ text.relocations.push_back(makeScatReloc(0x04,
ARM_RELOC_HALF_SECTDIFF, 0x10));
- text.relocations.push_back(makeScatReloc(0x00,
+ text.relocations.push_back(makeScatReloc(0x00,
ARM_RELOC_PAIR, 0xC));
- text.relocations.push_back(makeScatReloc(0x08,
+ text.relocations.push_back(makeScatReloc(0x08,
ARM_RELOC_HALF_SECTDIFF, 0x10));
- text.relocations.push_back(makeScatReloc(0x00,
+ text.relocations.push_back(makeScatReloc(0x00,
ARM_RELOC_PAIR, 0xC));
- text.relocations.push_back(makeReloc(0x0C, false, true,
+ text.relocations.push_back(makeReloc(0x0C, false, true,
ARM_RELOC_VANILLA, 2));
-
+
f.globalSymbols.push_back(makeThumbSymbol("_foo", 0x00));
f.globalSymbols.push_back(makeThumbSymbol("_foo2", 0x10));
f.undefinedSymbols.push_back(makeUndefSymbol("_bar"));
@@ -391,7 +391,7 @@ TEST(BinaryWriterTest, obj_relocs_armv7)
EXPECT_EQ(lld::MachOLinkingContext::arch_armv7, f2->arch);
EXPECT_EQ(MH_OBJECT, f2->fileType);
EXPECT_EQ(FileFlags(MH_SUBSECTIONS_VIA_SYMBOLS), f2->flags);
-
+
EXPECT_TRUE(f2->localSymbols.empty());
EXPECT_EQ(2UL, f2->globalSymbols.size());
const Symbol& fooDef = f2->globalSymbols[0];
@@ -404,19 +404,19 @@ TEST(BinaryWriterTest, obj_relocs_armv7)
EXPECT_EQ(N_SECT, foo2Def.type);
EXPECT_EQ(1, foo2Def.sect);
EXPECT_EQ(SymbolScope(N_EXT), foo2Def.scope);
-
+
EXPECT_EQ(1UL, f2->undefinedSymbols.size());
const Symbol& barUndef = f2->undefinedSymbols[0];
EXPECT_TRUE(barUndef.name.equals("_bar"));
EXPECT_EQ(N_UNDF, barUndef.type);
EXPECT_EQ(SymbolScope(N_EXT), barUndef.scope);
-
+
EXPECT_EQ(1UL, f2->sections.size());
const Section& text = f2->sections[0];
EXPECT_TRUE(text.segmentName.equals("__TEXT"));
EXPECT_TRUE(text.sectionName.equals("__text"));
EXPECT_EQ(S_REGULAR, text.type);
- EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(text.alignment, 2U);
EXPECT_EQ(text.address, Hex64(0x0));
@@ -459,7 +459,7 @@ TEST(BinaryWriterTest, obj_relocs_armv7)
EXPECT_EQ(absPointer.length, 2);
EXPECT_EQ(absPointer.isExtern, true);
EXPECT_EQ(absPointer.symbol, 2U);
-
+
//llvm::errs() << "temp = " << tmpFl << "\n";
error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
EXPECT_FALSE(ec);
@@ -480,7 +480,7 @@ TEST(BinaryWriterTest, obj_relocs_ppc) {
text.segmentName = "__TEXT";
text.sectionName = "__text";
text.type = S_REGULAR;
- text.attributes = SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ text.attributes = SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS);
text.alignment = 2;
text.address = 0;
@@ -493,25 +493,25 @@ TEST(BinaryWriterTest, obj_relocs_ppc) {
0x60, 0x00, 0x00, 0x00 };
text.content = llvm::makeArrayRef(textBytes, sizeof(textBytes));
- text.relocations.push_back(makeReloc(0x00, true, true,
+ text.relocations.push_back(makeReloc(0x00, true, true,
PPC_RELOC_BR24, 2));
- text.relocations.push_back(makeReloc(0x04, true, true,
+ text.relocations.push_back(makeReloc(0x04, true, true,
PPC_RELOC_BR14, 2));
- text.relocations.push_back(makeScatReloc(0x08,
+ text.relocations.push_back(makeScatReloc(0x08,
PPC_RELOC_HI16_SECTDIFF, 0x28));
- text.relocations.push_back(makeScatReloc(0x24,
+ text.relocations.push_back(makeScatReloc(0x24,
PPC_RELOC_PAIR, 0x4));
- text.relocations.push_back(makeScatReloc(0x0C,
+ text.relocations.push_back(makeScatReloc(0x0C,
PPC_RELOC_HA16_SECTDIFF, 0x28));
- text.relocations.push_back(makeScatReloc(0x24,
+ text.relocations.push_back(makeScatReloc(0x24,
PPC_RELOC_PAIR, 0x4));
- text.relocations.push_back(makeScatReloc(0x10,
+ text.relocations.push_back(makeScatReloc(0x10,
PPC_RELOC_LO16_SECTDIFF, 0x28));
- text.relocations.push_back(makeScatReloc(0x00,
+ text.relocations.push_back(makeScatReloc(0x00,
PPC_RELOC_PAIR, 0x4));
- text.relocations.push_back(makeScatReloc(0x14,
+ text.relocations.push_back(makeScatReloc(0x14,
PPC_RELOC_LO14_SECTDIFF, 0x28));
- text.relocations.push_back(makeScatReloc(0x00,
+ text.relocations.push_back(makeScatReloc(0x00,
PPC_RELOC_PAIR, 0x4));
text.relocations.push_back(makeReloc(0x18, false, false,
PPC_RELOC_HI16, 1));
@@ -546,7 +546,7 @@ TEST(BinaryWriterTest, obj_relocs_ppc) {
EXPECT_EQ(lld::MachOLinkingContext::arch_ppc, f2->arch);
EXPECT_EQ(MH_OBJECT, f2->fileType);
EXPECT_EQ(FileFlags(MH_SUBSECTIONS_VIA_SYMBOLS), f2->flags);
-
+
EXPECT_TRUE(f2->localSymbols.empty());
EXPECT_EQ(2UL, f2->globalSymbols.size());
const Symbol& fooDef = f2->globalSymbols[0];
@@ -559,19 +559,19 @@ TEST(BinaryWriterTest, obj_relocs_ppc) {
EXPECT_EQ(N_SECT, foo2Def.type);
EXPECT_EQ(1, foo2Def.sect);
EXPECT_EQ(SymbolScope(N_EXT), foo2Def.scope);
-
+
EXPECT_EQ(1UL, f2->undefinedSymbols.size());
const Symbol& barUndef = f2->undefinedSymbols[0];
EXPECT_TRUE(barUndef.name.equals("_bar"));
EXPECT_EQ(N_UNDF, barUndef.type);
EXPECT_EQ(SymbolScope(N_EXT), barUndef.scope);
-
+
EXPECT_EQ(1UL, f2->sections.size());
const Section& text = f2->sections[0];
EXPECT_TRUE(text.segmentName.equals("__TEXT"));
EXPECT_TRUE(text.sectionName.equals("__text"));
EXPECT_EQ(S_REGULAR, text.type);
- EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ(text.attributes,SectionAttr(S_ATTR_PURE_INSTRUCTIONS
| S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(text.alignment, 2U);
EXPECT_EQ(text.address, Hex64(0x0));
@@ -688,7 +688,7 @@ TEST(BinaryWriterTest, obj_relocs_ppc) {
EXPECT_EQ(absloa2.type, PPC_RELOC_PAIR);
EXPECT_EQ(absloa2.length, 2);
EXPECT_EQ(absloa2.symbol, 0U);
-
+
error_code ec = llvm::sys::fs::remove(Twine(tmpFl));
EXPECT_FALSE(ec);
}
Modified: lld/trunk/unittests/MachOTests/MachONormalizedFileToAtomsTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/MachOTests/MachONormalizedFileToAtomsTests.cpp?rev=199164&r1=199163&r2=199164&view=diff
==============================================================================
--- lld/trunk/unittests/MachOTests/MachONormalizedFileToAtomsTests.cpp (original)
+++ lld/trunk/unittests/MachOTests/MachONormalizedFileToAtomsTests.cpp Mon Jan 13 17:21:33 2014
@@ -23,7 +23,7 @@ using namespace llvm::MachO;
TEST(ToAtomsTest, empty_obj_x86_64) {
NormalizedFile f;
f.arch = lld::MachOLinkingContext::arch_x86_64;
- ErrorOr<std::unique_ptr<const lld::File>> atom_f = normalizedToAtoms(f, "",
+ ErrorOr<std::unique_ptr<const lld::File>> atom_f = normalizedToAtoms(f, "",
false);
EXPECT_FALSE(!atom_f);
EXPECT_EQ(0U, (*atom_f)->defined().size());
@@ -58,8 +58,8 @@ TEST(ToAtomsTest, basic_obj_x86_64) {
bazSymbol.sect = 1;
bazSymbol.value = 3;
f.localSymbols.push_back(bazSymbol);
-
- ErrorOr<std::unique_ptr<const lld::File>> atom_f = normalizedToAtoms(f, "",
+
+ ErrorOr<std::unique_ptr<const lld::File>> atom_f = normalizedToAtoms(f, "",
false);
EXPECT_FALSE(!atom_f);
const lld::File &file = **atom_f;
@@ -75,7 +75,7 @@ TEST(ToAtomsTest, basic_obj_x86_64) {
EXPECT_EQ(0x90, atom1->rawContent()[0]);
EXPECT_EQ(0xC3, atom1->rawContent()[1]);
EXPECT_EQ(lld::Atom::scopeGlobal, atom1->scope());
-
+
EXPECT_TRUE(atom2->name().equals("_bar"));
EXPECT_EQ(1U, atom2->rawContent().size());
EXPECT_EQ(0xC3, atom2->rawContent()[0]);
Modified: lld/trunk/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp?rev=199164&r1=199163&r2=199164&view=diff
==============================================================================
--- lld/trunk/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp (original)
+++ lld/trunk/unittests/MachOTests/MachONormalizedFileYAMLTests.cpp Mon Jan 13 17:21:33 2014
@@ -27,7 +27,7 @@ using lld::mach_o::normalized::Relocatio
static std::unique_ptr<NormalizedFile> fromYAML(StringRef str) {
std::unique_ptr<MemoryBuffer> mb(MemoryBuffer::getMemBuffer(str));
- ErrorOr<std::unique_ptr<NormalizedFile>> r
+ ErrorOr<std::unique_ptr<NormalizedFile>> r
= lld::mach_o::normalized::readYaml(mb);
EXPECT_FALSE(!r);
return std::move(*r);
@@ -139,7 +139,7 @@ TEST(ObjectFileYAML, empty_armv7s) {
TEST(ObjectFileYAML, roundTrip) {
- std::string intermediate;
+ std::string intermediate;
{
NormalizedFile f;
f.arch = lld::MachOLinkingContext::arch_x86_64;
@@ -214,7 +214,7 @@ TEST(ObjectFileYAML, oneSection) {
EXPECT_TRUE(sect.segmentName.equals("__TEXT"));
EXPECT_TRUE(sect.sectionName.equals("__text"));
EXPECT_EQ((uint32_t)(sect.type), (uint32_t)(llvm::MachO::S_REGULAR));
- EXPECT_EQ((uint32_t)(sect.attributes),
+ EXPECT_EQ((uint32_t)(sect.attributes),
(uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS));
EXPECT_EQ(sect.alignment, 1U);
EXPECT_EQ((uint64_t)sect.address, 0x12345678ULL);
@@ -281,13 +281,13 @@ TEST(ObjectFileYAML, hello_x86_64) {
EXPECT_EQ(f->fileType, llvm::MachO::MH_OBJECT);
EXPECT_EQ((int)(f->flags), llvm::MachO::MH_SUBSECTIONS_VIA_SYMBOLS);
EXPECT_EQ(f->sections.size(), 2UL);
-
+
const Section& sect1 = f->sections[0];
EXPECT_TRUE(sect1.segmentName.equals("__TEXT"));
EXPECT_TRUE(sect1.sectionName.equals("__text"));
EXPECT_EQ((uint32_t)(sect1.type), (uint32_t)(llvm::MachO::S_REGULAR));
- EXPECT_EQ((uint32_t)(sect1.attributes),
- (uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ((uint32_t)(sect1.attributes),
+ (uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
| llvm::MachO::S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(sect1.alignment, 0U);
EXPECT_EQ((uint64_t)sect1.address, 0x0ULL);
@@ -313,7 +313,7 @@ TEST(ObjectFileYAML, hello_x86_64) {
EXPECT_TRUE(reloc2.isExtern);
EXPECT_EQ(reloc2.symbol, 1U);
EXPECT_EQ((int)(reloc2.value), 0);
-
+
const Section& sect2 = f->sections[1];
EXPECT_TRUE(sect2.segmentName.equals("__TEXT"));
EXPECT_TRUE(sect2.sectionName.equals("__cstring"));
@@ -325,7 +325,7 @@ TEST(ObjectFileYAML, hello_x86_64) {
EXPECT_EQ((int)(sect2.content[0]), 0x68);
EXPECT_EQ((int)(sect2.content[1]), 0x65);
EXPECT_EQ((int)(sect2.content[2]), 0x6c);
-
+
EXPECT_EQ(f->globalSymbols.size(), 1UL);
const Symbol& sym1 = f->globalSymbols[0];
EXPECT_TRUE(sym1.name.equals("_main"));
@@ -412,13 +412,13 @@ TEST(ObjectFileYAML, hello_x86) {
EXPECT_EQ(f->fileType, llvm::MachO::MH_OBJECT);
EXPECT_EQ((int)(f->flags), llvm::MachO::MH_SUBSECTIONS_VIA_SYMBOLS);
EXPECT_EQ(f->sections.size(), 2UL);
-
+
const Section& sect1 = f->sections[0];
EXPECT_TRUE(sect1.segmentName.equals("__TEXT"));
EXPECT_TRUE(sect1.sectionName.equals("__text"));
EXPECT_EQ((uint32_t)(sect1.type), (uint32_t)(llvm::MachO::S_REGULAR));
- EXPECT_EQ((uint32_t)(sect1.attributes),
- (uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ((uint32_t)(sect1.attributes),
+ (uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
| llvm::MachO::S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(sect1.alignment, 0U);
EXPECT_EQ((uint64_t)sect1.address, 0x0ULL);
@@ -451,7 +451,7 @@ TEST(ObjectFileYAML, hello_x86) {
EXPECT_FALSE(reloc3.pcRel);
EXPECT_EQ(reloc3.symbol, 0U);
EXPECT_EQ((int)(reloc3.value), 0xb);
-
+
const Section& sect2 = f->sections[1];
EXPECT_TRUE(sect2.segmentName.equals("__TEXT"));
EXPECT_TRUE(sect2.sectionName.equals("__cstring"));
@@ -463,7 +463,7 @@ TEST(ObjectFileYAML, hello_x86) {
EXPECT_EQ((int)(sect2.content[0]), 0x68);
EXPECT_EQ((int)(sect2.content[1]), 0x65);
EXPECT_EQ((int)(sect2.content[2]), 0x6c);
-
+
EXPECT_EQ(f->globalSymbols.size(), 1UL);
const Symbol& sym1 = f->globalSymbols[0];
EXPECT_TRUE(sym1.name.equals("_main"));
@@ -540,13 +540,13 @@ TEST(ObjectFileYAML, hello_armv6) {
EXPECT_EQ(f->fileType, llvm::MachO::MH_OBJECT);
EXPECT_EQ((int)(f->flags), llvm::MachO::MH_SUBSECTIONS_VIA_SYMBOLS);
EXPECT_EQ(f->sections.size(), 2UL);
-
+
const Section& sect1 = f->sections[0];
EXPECT_TRUE(sect1.segmentName.equals("__TEXT"));
EXPECT_TRUE(sect1.sectionName.equals("__text"));
EXPECT_EQ((uint32_t)(sect1.type), (uint32_t)(llvm::MachO::S_REGULAR));
- EXPECT_EQ((uint32_t)(sect1.attributes),
- (uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ((uint32_t)(sect1.attributes),
+ (uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
| llvm::MachO::S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(sect1.alignment, 2U);
EXPECT_EQ((uint64_t)sect1.address, 0x0ULL);
@@ -579,7 +579,7 @@ TEST(ObjectFileYAML, hello_armv6) {
EXPECT_TRUE(reloc3.isExtern);
EXPECT_EQ(reloc3.symbol, 1U);
EXPECT_EQ((int)(reloc3.value), 0);
-
+
const Section& sect2 = f->sections[1];
EXPECT_TRUE(sect2.segmentName.equals("__TEXT"));
EXPECT_TRUE(sect2.sectionName.equals("__cstring"));
@@ -591,7 +591,7 @@ TEST(ObjectFileYAML, hello_armv6) {
EXPECT_EQ((int)(sect2.content[0]), 0x68);
EXPECT_EQ((int)(sect2.content[1]), 0x65);
EXPECT_EQ((int)(sect2.content[2]), 0x6c);
-
+
EXPECT_EQ(f->globalSymbols.size(), 1UL);
const Symbol& sym1 = f->globalSymbols[0];
EXPECT_TRUE(sym1.name.equals("_main"));
@@ -682,13 +682,13 @@ TEST(ObjectFileYAML, hello_armv7) {
EXPECT_EQ(f->fileType, llvm::MachO::MH_OBJECT);
EXPECT_EQ((int)(f->flags), llvm::MachO::MH_SUBSECTIONS_VIA_SYMBOLS);
EXPECT_EQ(f->sections.size(), 2UL);
-
+
const Section& sect1 = f->sections[0];
EXPECT_TRUE(sect1.segmentName.equals("__TEXT"));
EXPECT_TRUE(sect1.sectionName.equals("__text"));
EXPECT_EQ((uint32_t)(sect1.type), (uint32_t)(llvm::MachO::S_REGULAR));
- EXPECT_EQ((uint32_t)(sect1.attributes),
- (uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
+ EXPECT_EQ((uint32_t)(sect1.attributes),
+ (uint32_t)(llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
| llvm::MachO::S_ATTR_SOME_INSTRUCTIONS));
EXPECT_EQ(sect1.alignment, 1U);
EXPECT_EQ((uint64_t)sect1.address, 0x0ULL);
@@ -749,7 +749,7 @@ TEST(ObjectFileYAML, hello_armv7) {
EXPECT_EQ((int)(sect2.content[0]), 0x68);
EXPECT_EQ((int)(sect2.content[1]), 0x65);
EXPECT_EQ((int)(sect2.content[2]), 0x6c);
-
+
EXPECT_EQ(f->globalSymbols.size(), 1UL);
const Symbol& sym1 = f->globalSymbols[0];
EXPECT_TRUE(sym1.name.equals("_main"));
More information about the llvm-commits
mailing list