diff options
author | Shankar Easwaran <shankare@codeaurora.org> | 2014-01-27 03:09:26 +0000 |
---|---|---|
committer | Shankar Easwaran <shankare@codeaurora.org> | 2014-01-27 03:09:26 +0000 |
commit | 3d8de47f76529dba40fc34d497576d9cb51330bc (patch) | |
tree | 143515f3acdefd2c6c53e2553af9b34ff120a13d | |
parent | a64ba010f040003685c507c82237dae9fd4e6f59 (diff) | |
download | bcm5719-llvm-3d8de47f76529dba40fc34d497576d9cb51330bc.tar.gz bcm5719-llvm-3d8de47f76529dba40fc34d497576d9cb51330bc.zip |
Fix trailing whitespace.
llvm-svn: 200182
94 files changed, 560 insertions, 560 deletions
diff --git a/lld/docs/C++11.rst b/lld/docs/C++11.rst index 6eca731a862..9128fd62bf4 100644 --- a/lld/docs/C++11.rst +++ b/lld/docs/C++11.rst @@ -21,7 +21,7 @@ to omit (such as final or = delete) may be conditionally used via macros. * Forward enum declarations * Lambdas * Local and unnamed types as template args -* Trailing return type +* Trailing return type * nullptr * >> instead of > > * R-Value references excluding R-Value references for this diff --git a/lld/docs/Driver.rst b/lld/docs/Driver.rst index 49010ee80ab..5f2d946d36b 100644 --- a/lld/docs/Driver.rst +++ b/lld/docs/Driver.rst @@ -23,7 +23,7 @@ Flavors ------- Each of these different interfaces is referred to as a flavor. There is also an -extra flavor "core" which is used to exercise the core functionality of the +extra flavor "core" which is used to exercise the core functionality of the linker it the test suite. * gnu @@ -51,7 +51,7 @@ Adding an Option to an existing Flavor #. Add to :cpp:class:`lld::FlavorLinkingContext` a getter and setter method for the option. - + #. Modify :cpp:func:`lld::FlavorDriver::parse` in :file: `lib/Driver/{Flavor}Driver.cpp` to call the targetInfo setter for corresponding to the option. @@ -66,7 +66,7 @@ Adding a Flavor :cpp:class:`lld::UniversalDriver::Flavor`. #. Add an entry in :file:`lib/Driver/UniversalDriver.cpp` to - :cpp:func:`lld::Driver::strToFlavor` and + :cpp:func:`lld::Driver::strToFlavor` and :cpp:func:`lld::UniversalDriver::link`. This allows the flavor to be selected via symlink and :option:`-flavor`. @@ -76,4 +76,4 @@ Adding a Flavor must also be added to :file:`lib/Driver/CMakeLists.txt`. #. Add a ``{flavor}Driver`` as a subclass of :cpp:class:`lld::Driver` - in :file:`lib/Driver/{flavor}Driver.cpp`. + in :file:`lib/Driver/{flavor}Driver.cpp`. diff --git a/lld/docs/Readers.rst b/lld/docs/Readers.rst index ddda4736f49..6ad58e0f848 100644 --- a/lld/docs/Readers.rst +++ b/lld/docs/Readers.rst @@ -20,7 +20,7 @@ following pieces in order to fit into lld: .. cpp:class:: ReaderOptionsFoo : public ReaderOptions - This Options class is the only way to configure how the Reader will + This Options class is the only way to configure how the Reader will parse any file into an `lld::Reader`:cpp:class: object. This class should be declared in the `lld`:cpp:class: namespace. diff --git a/lld/docs/design.rst b/lld/docs/design.rst index 2a79bd0a461..21ebcbf1049 100644 --- a/lld/docs/design.rst +++ b/lld/docs/design.rst @@ -46,20 +46,20 @@ There are only four different types of atoms: * DefinedAtom 95% of all atoms. This is a chunk of code or data - - * UndefinedAtom + + * UndefinedAtom This is a place holder in object files for a reference to some atom outside the translation unit.During core linking it is usually replaced by (coalesced into) another Atom. - + * SharedLibraryAtom - If a required symbol name turns out to be defined in a dynamic shared - library (and not some object file). A SharedLibraryAtom is the + If a required symbol name turns out to be defined in a dynamic shared + library (and not some object file). A SharedLibraryAtom is the placeholder Atom used to represent that fact. - - It is similar to an UndefinedAtom, but it also tracks information + + It is similar to an UndefinedAtom, but it also tracks information about the associated shared library. - + * AbsoluteAtom This is for embedded support where some stuff is implemented in ROM at some fixed address. This atom has no content. It is just an address @@ -112,7 +112,7 @@ instantiated by the by the reader which the linker uses to replace the Linking Steps ------------- -Through the use of abstract Atoms, the core of linking is architecture +Through the use of abstract Atoms, the core of linking is architecture independent and file format independent. All command line parsing is factored out into a separate "options" abstraction which enables the linker to be driven with different command line sets. @@ -136,27 +136,27 @@ they have no notion of file formats such as mach-o or ELF. Input Files ~~~~~~~~~~~ -Existing developer tools using different file formats for object files. +Existing developer tools using different file formats for object files. A goal of lld is to be file format independent. This is done through a plug-in model for reading object files. The lld::Reader is the base class for all object file readers. A Reader follows the factory method pattern. A Reader instantiates an lld::File object (which is a graph of Atoms) from a given object file (on disk or in-memory). -Every Reader subclass defines its own "options" class (for instance the mach-o -Reader defines the class ReaderOptionsMachO). This options class is the +Every Reader subclass defines its own "options" class (for instance the mach-o +Reader defines the class ReaderOptionsMachO). This options class is the one-and-only way to control how the Reader operates when parsing an input file into an Atom graph. For instance, you may want the Reader to only accept certain architectures. The options class can be instantiated from command -line options, or it can be subclassed and the ivars programmatically set. +line options, or it can be subclassed and the ivars programmatically set. Resolving ~~~~~~~~~ -The resolving step takes all the atoms' graphs from each object file and -combines them into one master object graph. Unfortunately, it is not as simple -as appending the atom list from each file into one big list. There are many +The resolving step takes all the atoms' graphs from each object file and +combines them into one master object graph. Unfortunately, it is not as simple +as appending the atom list from each file into one big list. There are many cases where atoms need to be coalesced. That is, two or more atoms need to be coalesced into one atom. This is necessary to support: C language "tentative definitions", C++ weak symbols for templates and inlines defined in headers, @@ -241,30 +241,30 @@ object. The writer's job is to create the executable content file wrapper and place the content of the atoms into it. lld uses a plug-in model for writing output files. All concrete writers (e.g. -ELF, mach-o, etc) are subclasses of the lld::Writer class. +ELF, mach-o, etc) are subclasses of the lld::Writer class. Unlike the Reader class which has just one method to instantiate an lld::File, -the Writer class has multiple methods. The crucial method is to generate the +the Writer class has multiple methods. The crucial method is to generate the output file, but there are also methods which allow the Writer to contribute -Atoms to the resolver and specify passes to run. +Atoms to the resolver and specify passes to run. An example of contributing atoms is that if the Writer knows a main executable is being linked and such an executable requires a specially named entry point (e.g. "_main"), the Writer -can add an UndefinedAtom with that special name to the resolver. This will -cause the resolver to issue an error if that symbol is not defined. +can add an UndefinedAtom with that special name to the resolver. This will +cause the resolver to issue an error if that symbol is not defined. Sometimes a Writer supports lazily created symbols, such as names for the start -of sections. To support this, the Writer can create a File object which vends -no initial atoms, but does lazily supply atoms by name as needed. +of sections. To support this, the Writer can create a File object which vends +no initial atoms, but does lazily supply atoms by name as needed. -Every Writer subclass defines its own "options" class (for instance the mach-o -Writer defines the class WriterOptionsMachO). This options class is the -one-and-only way to control how the Writer operates when producing an output +Every Writer subclass defines its own "options" class (for instance the mach-o +Writer defines the class WriterOptionsMachO). This options class is the +one-and-only way to control how the Writer operates when producing an output file from an Atom graph. For instance, you may want the Writer to optimize -the output for certain OS versions, or strip local symbols, etc. The options -class can be instantiated from command line options, or it can be subclassed -and the ivars programmatically set. +the output for certain OS versions, or strip local symbols, etc. The options +class can be instantiated from command line options, or it can be subclassed +and the ivars programmatically set. lld::File representations @@ -317,11 +317,11 @@ updated to do its best to model (the lack of the new feature) given the old ivar data in existing native object files. With this model for the native file format, files can be read and turned -into the in-memory graph of lld::Atoms with just a few memory allocations. +into the in-memory graph of lld::Atoms with just a few memory allocations. And the format can easily adapt over time to new features. -The binary file format follows the ReaderWriter patterns used in lld. The lld -library comes with the classes: ReaderNative and WriterNative. So, switching +The binary file format follows the ReaderWriter patterns used in lld. The lld +library comes with the classes: ReaderNative and WriterNative. So, switching between file formats is as easy as switching which Reader subclass is used. @@ -335,7 +335,7 @@ that those can be omitted from the text representation. Here is the atoms for a simple hello world program expressed in YAML:: target-triple: x86_64-apple-darwin11 - + atoms: - name: _main scope: global @@ -349,10 +349,10 @@ simple hello world program expressed in YAML:: - offset: 0E kind: call32 target: _fprintf - + - type: c-string content: [ 73, 5A, 00 ] - + ... The biggest use for the textual format will be writing test cases. Writing test @@ -362,8 +362,8 @@ feature trying to be tested. By writing test cases in the linkers own textual format, we can exactly specify every attribute of every atom and thus target specific linker logic. -The textual/YAML format follows the ReaderWriter patterns used in lld. The lld -library comes with the classes: ReaderYAML and WriterYAML. +The textual/YAML format follows the ReaderWriter patterns used in lld. The lld +library comes with the classes: ReaderYAML and WriterYAML. Testing @@ -397,11 +397,11 @@ undefined atom from one file will be replaced by a definition from another file:: # RUN: lld-core %s | FileCheck %s - + # # Test that undefined atoms are replaced with defined atoms. # - + --- atoms: - name: foo @@ -412,7 +412,7 @@ file:: scope: global type: code ... - + # CHECK: name: foo # CHECK: scope: global # CHECK: type: code diff --git a/lld/docs/llvm-theme/static/llvm.css b/lld/docs/llvm-theme/static/llvm.css index da4f648061e..32802bb6a2d 100644 --- a/lld/docs/llvm-theme/static/llvm.css +++ b/lld/docs/llvm-theme/static/llvm.css @@ -140,7 +140,7 @@ div.footer a { /* -- body styles ----------------------------------------------------------- */ -p { +p { margin: 0.8em 0 0.5em 0; } diff --git a/lld/lib/Core/CMakeLists.txt b/lld/lib/Core/CMakeLists.txt index 1df4f016770..1854b1f0f3f 100644 --- a/lld/lib/Core/CMakeLists.txt +++ b/lld/lib/Core/CMakeLists.txt @@ -11,7 +11,7 @@ add_lld_library(lldCore SymbolTable.cpp ) -target_link_libraries(lldCore +target_link_libraries(lldCore lldNative lldYAML ) diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp index 328399389ee..4dde6bae231 100644 --- a/lld/lib/Driver/DarwinLdDriver.cpp +++ b/lld/lib/Driver/DarwinLdDriver.cpp @@ -251,7 +251,7 @@ bool DarwinLdDriver::parse(int argc, const char *argv[], } } - // Handle -mllvm + // Handle -mllvm for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_mllvm), ie = parsedArgs->filtered_end(); it != ie; ++it) { diff --git a/lld/lib/Driver/GnuLdOptions.td b/lld/lib/Driver/GnuLdOptions.td index 6532b6f2dc0..57f38518f98 100644 --- a/lld/lib/Driver/GnuLdOptions.td +++ b/lld/lib/Driver/GnuLdOptions.td @@ -189,7 +189,7 @@ def use_shlib_undefs: Flag<["--"], "use-shlib-undefines">, Group<grp_resolveropt>; //===----------------------------------------------------------------------===// -/// Custom Options +/// Custom Options //===----------------------------------------------------------------------===// def grp_customopts : OptionGroup<"opts">, HelpText<"CUSTOM OPTIONS">; diff --git a/lld/lib/ReaderWriter/ELF/CreateELF.h b/lld/lib/ReaderWriter/ELF/CreateELF.h index 7d7670b0ea4..ad34dddb24d 100644 --- a/lld/lib/ReaderWriter/ELF/CreateELF.h +++ b/lld/lib/ReaderWriter/ELF/CreateELF.h @@ -99,7 +99,7 @@ typename Traits::result_type createELF( LLVM_CREATE_ELF_IMPL(std::forward<T1>(t1), std::forward<T2>(t2), std::forward<T3>(t3)) } - + template <class Traits, class T1, class T2, class T3, class T4> typename Traits::result_type createELF( std::pair<unsigned char, unsigned char> ident, std::size_t maxAlignment, diff --git a/lld/lib/ReaderWriter/MachO/GOTPass.hpp b/lld/lib/ReaderWriter/MachO/GOTPass.hpp index 4342b3e0c04..9f99fc14699 100644 --- a/lld/lib/ReaderWriter/MachO/GOTPass.hpp +++ b/lld/lib/ReaderWriter/MachO/GOTPass.hpp @@ -34,18 +34,18 @@ public: } virtual void updateReferenceToGOT(const Reference*, bool targetIsNowGOT) { - + } virtual const DefinedAtom* makeGOTEntry(const Atom&) { return nullptr; } - + }; -} // namespace mach_o -} // namespace lld +} // namespace mach_o +} // namespace lld #endif // LLD_READER_WRITER_MACHO_GOT_PASS_H diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h index 435202a97a6..b135998d87a 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h @@ -10,34 +10,34 @@ /// /// \file These data structures comprise the "normalized" view of /// mach-o object files. The normalized view is an in-memory only data structure -/// which is always in native endianness and pointer size. -/// -/// The normalized view easily converts to and from YAML using YAML I/O. +/// which is always in native endianness and pointer size. +/// +/// The normalized view easily converts to and from YAML using YAML I/O. /// /// The normalized view converts to and from binary mach-o object files using /// the writeBinary() and readBinary() functions. /// -/// The normalized view converts to and from lld::Atoms using the +/// The normalized view converts to and from lld::Atoms using the /// normalizedToAtoms() and normalizedFromAtoms(). /// /// Overall, the conversion paths available look like: /// -/// +---------------+ -/// | binary mach-o | -/// +---------------+ +/// +---------------+ +/// | binary mach-o | +/// +---------------+ /// ^ /// | /// v -/// +------------+ +------+ -/// | normalized | <-> | yaml | -/// +------------+ +------+ +/// +------------+ +------+ +/// | normalized | <-> | yaml | +/// +------------+ +------+ /// ^ /// | /// v -/// +-------+ +/// +-------+ /// | Atoms | -/// +-------+ -/// +/// +-------+ +/// #include "lld/Core/Error.h" #include "lld/Core/LLVM.h" @@ -76,9 +76,9 @@ namespace normalized { /// encoded in one of two different bit-field patterns. This /// normalized form has the union of all possible fields. struct Relocation { - Relocation() : offset(0), scattered(false), - type(llvm::MachO::GENERIC_RELOC_VANILLA), - length(0), pcRel(false), isExtern(false), value(0), + Relocation() : offset(0), scattered(false), + type(llvm::MachO::GENERIC_RELOC_VANILLA), + length(0), pcRel(false), isExtern(false), value(0), symbol(0) { } Hex32 offset; @@ -106,7 +106,7 @@ LLVM_YAML_STRONG_TYPEDEF(uint32_t, SectionAttr); /// Mach-O has a 32-bit and 64-bit section record. This normalized form /// can support either kind. struct Section { - Section() : type(llvm::MachO::S_REGULAR), + Section() : type(llvm::MachO::S_REGULAR), attributes(0), alignment(0), address(0) { } StringRef segmentName; @@ -129,7 +129,7 @@ LLVM_YAML_STRONG_TYPEDEF(uint16_t, SymbolDesc); /// Mach-O has a 32-bit and 64-bit symbol table entry (nlist), and the symbol /// type and scope and mixed in the same n_type field. This normalized form -/// works for any pointer size and separates out the type and scope. +/// works for any pointer size and separates out the type and scope. struct Symbol { Symbol() : type(llvm::MachO::N_UNDF), scope(0), sect(0), desc(0), value(0) { } @@ -195,25 +195,25 @@ struct Export { /// A typedef so that YAML I/O can encode/decode mach_header.flags. LLVM_YAML_STRONG_TYPEDEF(uint32_t, FileFlags); -/// +/// struct NormalizedFile { - NormalizedFile() : arch(MachOLinkingContext::arch_unknown), + NormalizedFile() : arch(MachOLinkingContext::arch_unknown), fileType(llvm::MachO::MH_OBJECT), - flags(0), - hasUUID(false), + flags(0), + hasUUID(false), os(MachOLinkingContext::OS::unknown) { } - + MachOLinkingContext::Arch arch; HeaderFileType fileType; FileFlags flags; std::vector<Segment> segments; // Not used in object files. std::vector<Section> sections; - + // Symbols sorted by kind. std::vector<Symbol> localSymbols; std::vector<Symbol> globalSymbols; std::vector<Symbol> undefinedSymbols; - + // Maps to load commands with no LINKEDIT content (final linked images only). std::vector<DependentDylib> dependentDylibs; StringRef installName; @@ -224,20 +224,20 @@ struct NormalizedFile { Hex64 sourceVersion; Hex32 minOSverson; Hex32 sdkVersion; - + // Maps to load commands with LINKEDIT content (final linked images only). std::vector<RebaseLocation> rebasingInfo; std::vector<BindLocation> bindingInfo; std::vector<BindLocation> weakBindingInfo; std::vector<BindLocation> lazyBindingInfo; std::vector<Export> exportInfo; - + // TODO: // code-signature // split-seg-info // function-starts // data-in-code - + // For any allocations in this struct which need to be owned by this struct. BumpPtrAllocator ownedAllocations; }; @@ -249,28 +249,28 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, const MachOLinkingContext::Arch arch); /// Takes in-memory normalized view and writes a mach-o object file. -error_code +error_code writeBinary(const NormalizedFile &file, StringRef path); size_t headerAndLoadCommandsSize(const NormalizedFile &file); /// Parses a yaml encoded mach-o file to produce an in-memory normalized view. -ErrorOr<std::unique_ptr<NormalizedFile>> +ErrorOr<std::unique_ptr<NormalizedFile>> readYaml(std::unique_ptr<MemoryBuffer> &mb); /// Writes a yaml encoded mach-o files given an in-memory normalized view. -error_code +error_code writeYaml(const NormalizedFile &file, raw_ostream &out); /// Takes in-memory normalized dylib or object and parses it into lld::File ErrorOr<std::unique_ptr<lld::File>> -normalizedToAtoms(const NormalizedFile &normalizedFile, StringRef path, +normalizedToAtoms(const NormalizedFile &normalizedFile, StringRef path, bool copyRefs); /// Takes atoms and generates a normalized macho-o view. -ErrorOr<std::unique_ptr<NormalizedFile>> +ErrorOr<std::unique_ptr<NormalizedFile>> normalizedFromAtoms(const lld::File &atomFile, const MachOLinkingContext &ctxt); diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp index 7b3b36de358..4d793706d9d 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp @@ -50,9 +50,9 @@ namespace mach_o { namespace normalized { // Utility to call a lambda expression on each load command. -static error_code +static error_code forEachLoadCommand(StringRef lcRange, unsigned lcCount, bool swap, bool is64, - std::function<bool (uint32_t cmd, uint32_t size, + std::function<bool (uint32_t cmd, uint32_t size, const char* lc)> func) { const char* p = lcRange.begin(); for (unsigned i=0; i < lcCount; ++i) { @@ -66,25 +66,25 @@ forEachLoadCommand(StringRef lcRange, unsigned lcCount, bool swap, bool is64, } if ( (p + slc->cmdsize) > lcRange.end() ) return llvm::make_error_code(llvm::errc::executable_format_error); - + if (func(slc->cmd, slc->cmdsize, p)) return error_code::success(); - + p += slc->cmdsize; - } - + } + return error_code::success(); } -static error_code -appendRelocations(Relocations &relocs, StringRef buffer, bool swap, +static error_code +appendRelocations(Relocations &relocs, StringRef buffer, bool swap, bool bigEndian, uint32_t reloff, uint32_t nreloc) { if ((reloff + nreloc*8) > buffer.size()) return llvm::make_error_code(llvm::errc::executable_format_error); - const any_relocation_info* relocsArray = + const any_relocation_info* relocsArray = reinterpret_cast<const any_relocation_info*>(buffer.begin()+reloff); - + for(uint32_t i=0; i < nreloc; ++i) { relocs.push_back(unpackRelocation(relocsArray[i], swap, bigEndian)); } @@ -186,27 +186,27 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, // Walk load commands looking for segments/sections and the symbol table. - error_code ec = forEachLoadCommand(lcRange, lcCount, swap, is64, + error_code ec = forEachLoadCommand(lcRange, lcCount, swap, is64, [&] (uint32_t cmd, uint32_t size, const char* lc) -> bool { if (is64) { if (cmd == LC_SEGMENT_64) { - const segment_command_64 *seg = + const segment_command_64 *seg = reinterpret_cast<const segment_command_64*>(lc); const unsigned sectionCount = (swap ? SwapByteOrder(seg->nsects) : seg->nsects); const section_64 *sects = reinterpret_cast<const section_64*> (lc + sizeof(segment_command_64)); - const unsigned lcSize = sizeof(segment_command_64) + const unsigned lcSize = sizeof(segment_command_64) + sectionCount*sizeof(section_64); // Verify sections don't extend beyond end of segment load command. - if (lcSize > size) + if (lcSize > size) return llvm::make_error_code(llvm::errc::executable_format_error); for (unsigned i=0; i < sectionCount; ++i) { const section_64 *sect = §s[i]; Section section; section.segmentName = getString16(sect->segname); section.sectionName = getString16(sect->sectname); - section.type = (SectionType)(read32(swap, sect->flags) + section.type = (SectionType)(read32(swap, sect->flags) & SECTION_TYPE); section.attributes = read32(swap, sect->flags) & SECTION_ATTRIBUTES; section.alignment = read32(swap, sect->align); @@ -217,31 +217,31 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, // Note: this assign() is copying the content bytes. Ideally, // we can use a custom allocator for vector to avoid the copy. section.content = llvm::makeArrayRef(content, contentSize); - appendRelocations(section.relocations, mb->getBuffer(), - swap, isBigEndianArch, read32(swap, sect->reloff), + appendRelocations(section.relocations, mb->getBuffer(), + swap, isBigEndianArch, read32(swap, sect->reloff), read32(swap, sect->nreloc)); f->sections.push_back(section); } } } else { if (cmd == LC_SEGMENT) { - const segment_command *seg = + const segment_command *seg = reinterpret_cast<const segment_command*>(lc); const unsigned sectionCount = (swap ? SwapByteOrder(seg->nsects) : seg->nsects); const section *sects = reinterpret_cast<const section*> (lc + sizeof(segment_command)); - const unsigned lcSize = sizeof(segment_command) + const unsigned lcSize = sizeof(segment_command) + sectionCount*sizeof(section); // Verify sections don't extend beyond end of segment load command. - if (lcSize > size) + if (lcSize > size) return llvm::make_error_code(llvm::errc::executable_format_error); for (unsigned i=0; i < sectionCount; ++i) { const section *sect = §s[i]; Section section; section.segmentName = getString16(sect->segname); section.sectionName = getString16(sect->sectname); - section.type = (SectionType)(read32(swap, sect->flags) + section.type = (SectionType)(read32(swap, sect->flags) & SECTION_TYPE); section.attributes = read32(swap, sect->flags) & SECTION_ATTRIBUTES; section.alignment = read32(swap, sect->align); @@ -252,8 +252,8 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, // Note: this assign() is copying the content bytes. Ideally, // we can use a custom allocator for vector to avoid the copy. section.content = llvm::makeArrayRef(content, contentSize); - appendRelocations(section.relocations, mb->getBuffer(), - swap, isBigEndianArch, read32(swap, sect->reloff), + appendRelocations(section.relocations, mb->getBuffer(), + swap, isBigEndianArch, read32(swap, sect->reloff), read32(swap, sect->nreloc)); f->sections.push_back(section); } @@ -264,7 +264,7 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, const char *strings = start + read32(swap, st->stroff); const uint32_t strSize = read32(swap, st->strsize); // Validate string pool and symbol table all in buffer. - if ( read32(swap, st->stroff)+read32(swap, st->strsize) + if ( read32(swap, st->stroff)+read32(swap, st->strsize) > objSize ) return llvm::make_error_code(llvm::errc::executable_format_error); if (is64) { @@ -282,7 +282,7 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, tempSym = *sin; swapStruct(tempSym); sin = &tempSym; } Symbol sout; - if (sin->n_strx > strSize) + if (sin->n_strx > strSize) return llvm::make_error_code(llvm::errc::executable_format_error); sout.name = &strings[sin->n_strx]; sout.type = (NListType)(sin->n_type & N_TYPE); @@ -297,7 +297,7 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, else f->localSymbols.push_back(sout); } - } else { + } else { const uint32_t symOffset = read32(swap, st->symoff); const uint32_t symCount = read32(swap, st->nsyms); if ( symOffset+(symCount*sizeof(nlist)) > objSize) @@ -312,7 +312,7 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, tempSym = *sin; swapStruct(tempSym); sin = &tempSym; } Symbol sout; - if (sin->n_strx > strSize) + if (sin->n_strx > strSize) return llvm::make_error_code(llvm::errc::executable_format_error); sout.name = &strings[sin->n_strx]; sout.type = (NListType)(sin->n_type & N_TYPE); @@ -329,12 +329,12 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, } } } else if (cmd == LC_DYSYMTAB) { - // TODO: indirect symbols + // TODO: indirect symbols } return false; }); - if (ec) + if (ec) return ec; return std::move(f); diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h index 7f598592a95..5f8b9de7627 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h @@ -194,30 +194,30 @@ inline uint64_t read64(bool swap, uint64_t value) { -inline uint32_t -bitFieldExtract(uint32_t value, bool isBigEndianBigField, uint8_t firstBit, +inline uint32_t +bitFieldExtract(uint32_t value, bool isBigEndianBigField, uint8_t firstBit, uint8_t bitCount) { - const uint32_t mask = ((1<<bitCount)-1); + const uint32_t mask = ((1<<bitCount)-1); const uint8_t shift = isBigEndianBigField ? (32-firstBit-bitCount) : firstBit; return (value >> shift) & mask; } -inline void -bitFieldSet(uint32_t &bits, bool isBigEndianBigField, uint32_t newBits, +inline void +bitFieldSet(uint32_t &bits, bool isBigEndianBigField, uint32_t newBits, uint8_t firstBit, uint8_t bitCount) { - const uint32_t mask = ((1<<bitCount)-1); + const uint32_t mask = ((1<<bitCount)-1); assert((newBits & mask) == newBits); const uint8_t shift = isBigEndianBigField ? (32-firstBit-bitCount) : firstBit; bits &= ~(mask << shift); bits |= (newBits << shift); } -inline Relocation -unpackRelocation(const llvm::MachO::any_relocation_info &r, bool swap, +inline Relocation +unpackRelocation(const llvm::MachO::any_relocation_info &r, bool swap, bool isBigEndian) { uint32_t r0 = read32(swap, r.r_word0); uint32_t r1 = read32(swap, r.r_word1); - + Relocation result; if (r0 & llvm::MachO::R_SCATTERED) { // scattered relocation record always laid out like big endian bit field @@ -242,14 +242,14 @@ unpackRelocation(const llvm::MachO::any_relocation_info &r, bool swap, result.symbol = bitFieldExtract(r1, isBigEndian, 0, 24); } return result; -} +} -inline llvm::MachO::any_relocation_info +inline llvm::MachO::any_relocation_info packRelocation(const Relocation &r, bool swap, bool isBigEndian) { uint32_t r0 = 0; uint32_t r1 = 0; - + if (r.scattered) { r1 = r.value; bitFieldSet(r0, true, r.offset, 8, 24); @@ -265,12 +265,12 @@ packRelocation(const Relocation &r, bool swap, bool isBigEndian) { bitFieldSet(r1, isBigEndian, r.pcRel, 24, 1); bitFieldSet(r1, isBigEndian, r.symbol, 0, 24); } - + llvm::MachO::any_relocation_info result; result.r_word0 = swap ? SwapByteOrder(r0) : r0; result.r_word1 = swap ? SwapByteOrder(r1) : r1; return result; -} +} inline StringRef getString16(const char s[16]) { StringRef x = s; diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp index beecd331594..7b0b501c3b0 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp @@ -8,18 +8,18 @@ //===----------------------------------------------------------------------===// /// -/// \file For mach-o object files, this implementation converts normalized +/// \file For mach-o object files, this implementation converts normalized /// mach-o in memory to mach-o binary on disk. /// -/// +---------------+ -/// | binary mach-o | -/// +---------------+ +/// +---------------+ +/// | binary mach-o | +/// +---------------+ /// ^ /// | /// | -/// +------------+ -/// | normalized | -/// +------------+ +/// +------------+ +/// | normalized | +/// +------------+ #include "MachONormalizedFile.h" #include "MachONormalizedFileBinaryUtils.h" @@ -51,7 +51,7 @@ namespace mach_o { namespace normalized { /// Utility class for writing a mach-o binary file given an in-memory -/// normalized file. +/// normalized file. class MachOFileLayout { public: /// All layout computation is done in the constructor. @@ -60,11 +60,11 @@ public: /// Returns the final file size as computed in the constructor. size_t size() const; - /// Writes the normalized file as a binary mach-o file to the specified + /// Writes the normalized file as a binary mach-o file to the specified /// path. This does not have a stream interface because the generated /// file may need the 'x' bit set. error_code writeBinary(StringRef path); - + private: uint32_t loadCommandsSize(uint32_t &count); void buildFileOffsets(); @@ -101,7 +101,7 @@ private: typedef llvm::MachO::section section; enum { LC = llvm::MachO::LC_SEGMENT }; }; - + template <typename T> error_code writeSingleSegmentLoadCommand(uint8_t *&lc); template <typename T> @@ -109,7 +109,7 @@ private: uint32_t pointerAlign(uint32_t value); static StringRef dyldPath(); - + class ByteBuffer { public: ByteBuffer() : _ostream(_bytes) { } @@ -141,7 +141,7 @@ private: // Stream ivar must be after SmallVector ivar to construct properly. llvm::raw_svector_ostream _ostream; }; - + struct SegExtraInfo { uint32_t fileOffset; @@ -152,7 +152,7 @@ private: uint32_t fileOffset; }; typedef std::map<const Section*, SectionExtraInfo> SectionMap; - + const NormalizedFile &_file; error_code _ec; uint8_t *_buffer; @@ -207,19 +207,19 @@ StringRef MachOFileLayout::dyldPath() { uint32_t MachOFileLayout::pointerAlign(uint32_t value) { return llvm::RoundUpToAlignment(value, _is64 ? 8 : 4); -} +} - -MachOFileLayout::MachOFileLayout(const NormalizedFile &file) + +MachOFileLayout::MachOFileLayout(const NormalizedFile &file) : _file(file), _is64(MachOLinkingContext::is64Bit(file.arch)), _swap(!MachOLinkingContext::isHostEndian(file.arch)), _bigEndianArch(MachOLinkingContext::isBigEndian(file.arch)), _seg1addr(INT64_MAX) { _startOfLoadCommands = _is64 ? sizeof(mach_header_64) : sizeof(mach_header); - const size_t segCommandBaseSize = + const size_t segCommandBaseSize = (_is64 ? sizeof(segment_command_64) : sizeof(segment_command)); const size_t sectsSize = (_is64 ? sizeof(section_64) : sizeof(section)); if (file.fileType == llvm::MachO::MH_OBJECT) { @@ -229,7 +229,7 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file) + file.sections.size() * sectsSize + sizeof(symtab_command); _countOfLoadCommands = 2; - + // Accumulate size of each section. _startOfSectionsContent = _endOfLoadCommands; _endOfSectionsContent = _startOfSectionsContent; @@ -239,21 +239,21 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file) _endOfSectionsContent += sect.content.size(); relocCount += sect.relocations.size(); } - + computeSymbolTableSizes(); - + // Align start of relocations. - _startOfRelocations = pointerAlign(_endOfSectionsContent); + _startOfRelocations = pointerAlign(_endOfSectionsContent); _startOfSymbols = _startOfRelocations + relocCount * 8; // Add Indirect symbol table. _startOfIndirectSymbols = _startOfSymbols + _symbolTableSize; // Align start of symbol table and symbol strings. - _startOfSymbolStrings = _startOfIndirectSymbols + _startOfSymbolStrings = _startOfIndirectSymbols + pointerAlign(_indirectSymbolTableCount * sizeof(uint32_t)); - _endOfSymbolStrings = _startOfSymbolStrings + _endOfSymbolStrings = _startOfSymbolStrings + pointerAlign(_symbolStringPoolSize); _endOfLinkEdit = _endOfSymbolStrings; - DEBUG_WITH_TYPE("MachOFileLayout", + DEBUG_WITH_TYPE("MachOFileLayout", llvm::dbgs() << "MachOFileLayout()\n" << " startOfLoadCommands=" << _startOfLoadCommands << "\n" << " countOfLoadCommands=" << _countOfLoadCommands << "\n" @@ -266,13 +266,13 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file) << " endOfSectionsContent=" << _endOfSectionsContent << "\n"); } else { // Final linked images have one load command per segment. - _endOfLoadCommands = _startOfLoadCommands + _endOfLoadCommands = _startOfLoadCommands + loadCommandsSize(_countOfLoadCommands); // Assign section file offsets. buildFileOffsets(); buildLinkEditInfo(); - + // LINKEDIT of final linked images has in order: // rebase info, binding info, lazy binding info, weak binding info, // indirect symbol table, symbol table, symbol table strings. @@ -285,12 +285,12 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file) _startOfSymbols = _endOfLazyBindingInfo; _startOfIndirectSymbols = _startOfSymbols + _symbolTableSize; - _startOfSymbolStrings = _startOfIndirectSymbols + _startOfSymbolStrings = _startOfIndirectSymbols + pointerAlign(_indirectSymbolTableCount * sizeof(uint32_t)); - _endOfSymbolStrings = _startOfSymbolStrings + _endOfSymbolStrings = _startOfSymbolStrings + pointerAlign(_symbolStringPoolSize); _endOfLinkEdit = _endOfSymbolStrings; - DEBUG_WITH_TYPE("MachOFileLayout", + DEBUG_WITH_TYPE("MachOFileLayout", llvm::dbgs() << "MachOFileLayout()\n" << " startOfLoadCommands=" << _startOfLoadCommands << "\n" << " countOfLoadCommands=" << _countOfLoadCommands << "\n" @@ -312,8 +312,8 @@ MachOFileLayout::MachOFileLayout(const NormalizedFile &file) uint32_t MachOFileLayout::loadCommandsSize(uint32_t &count) { uint32_t size = 0; count = 0; - - const size_t segCommandSize = + + const size_t segCommandSize = (_is64 ? sizeof(segment_command_64) : sizeof(segment_command)); const size_t sectionSize = (_is64 ? sizeof(section_64) : sizeof(section)); @@ -325,21 +325,21 @@ uint32_t MachOFileLayout::loadCommandsSize(uint32_t &count) { // Add one LC_SEGMENT for implicit __LINKEDIT segment size += segCommandSize; ++count; - + // Add LC_DYLD_INFO size += sizeof(dyld_info_command); ++count; - + // Add LC_SYMTAB size += sizeof(symtab_command); ++count; - + // Add LC_DYSYMTAB if (_file.fileType != llvm::MachO::MH_PRELOAD) { size += sizeof(dysymtab_command); ++count; } - + // If main executable add LC_LOAD_DYLINKER and LC_MAIN if (_file.fileType == llvm::MachO::MH_EXECUTE) { size += pointerAlign(sizeof(dylinker_command) + dyldPath().size()+1); @@ -347,13 +347,13 @@ uint32_t MachOFileLayout::loadCommandsSize(uint32_t &count) { size += sizeof(entry_point_command); ++count; } - + // Add LC_LOAD_DYLIB for each dependent dylib. for (const DependentDylib &dep : _file.dependentDylibs) { size += sizeof(dylib_command) + pointerAlign(dep.path.size()+1); ++count; } - + return size; } @@ -385,8 +385,8 @@ void MachOFileLayout::buildFileOffsets() { } } } - - // Verify no sections overlap + + // Verify no sections overlap for (const Section &s1 : _file.sections) { for (const Section &s2 : _file.sections) { if (&s1 == &s2) @@ -397,7 +397,7 @@ void MachOFileLayout::buildFileOffsets() { } } } - + // Build side table of extra info about segments and sections. SegExtraInfo t; t.fileOffset = 0; @@ -410,7 +410,7 @@ void MachOFileLayout::buildFileOffsets() { for (const Section &s : _file.sections) { _sectInfo[&s] = t2; for (const Segment &sg : _file.segments) { - if ((s.address >= sg.address) + if ((s.address >= sg.address) && (s.address+s.content.size() <= sg.address+sg.size)) { if (!sg.name.equals(s.segmentName)) { _ec = llvm::make_error_code(llvm::errc::executable_format_error); @@ -420,23 +420,23 @@ void MachOFileLayout::buildFileOffsets() { } } } - + // Assign file offsets. uint32_t fileOffset = 0; - DEBUG_WITH_TYPE("MachOFileLayout", + DEBUG_WITH_TYPE("MachOFileLayout", llvm::dbgs() << "buildFileOffsets()\n"); for (const Segment &sg : _file.segments) { // FIXME: 4096 should be inferred from segments in normalized file. _segInfo[&sg].fileOffset = llvm::RoundUpToAlignment(fileOffset, 4096); if ((_seg1addr == INT64_MAX) && sg.access) _seg1addr = sg.address; - DEBUG_WITH_TYPE("MachOFileLayout", + DEBUG_WITH_TYPE("MachOFileLayout", llvm::dbgs() << " segment=" << sg.name << ", fileOffset=" << _segInfo[&sg].fileOffset << "\n"); for (const Section *s : _segInfo[&sg].sections) { fileOffset = s->address - sg.address + _segInfo[&sg].fileOffset; _sectInfo[s].fileOffset = fileOffset; - DEBUG_WITH_TYPE("MachOFileLayout", + DEBUG_WITH_TYPE("MachOFileLayout", llvm::dbgs() << " section=" << s->sectionName << ", fileOffset=" << fileOffset << "\n"); } @@ -463,7 +463,7 @@ void MachOFileLayout::writeMachHeader() { swapStruct(*mh); } -uint32_t MachOFileLayout::indirectSymbolIndex(const Section §, +uint32_t MachOFileLayout::indirectSymbolIndex(const Section §, uint32_t &index) { if (sect.indirectSymbols.empty()) return 0; @@ -486,7 +486,7 @@ template <typename T> error_code MachOFileLayout::writeSingleSegmentLoadCommand(uint8_t *&lc) { typename T::command* seg = reinterpret_cast<typename T::command*>(lc); seg->cmd = T::LC; - seg->cmdsize = sizeof(typename T::command) + seg->cmdsize = sizeof(typename T::command) + _file.sections.size() * sizeof(typename T::section); uint8_t *next = lc + seg->cmdsize; memset(seg->segname, 0, 16); @@ -536,7 +536,7 @@ error_code MachOFileLayout::writeSegmentLoadCommands(uint8_t *&lc) { SegExtraInfo &segInfo = _segInfo[&seg]; typename T::command* cmd = reinterpret_cast<typename T::command*>(lc); cmd->cmd = T::LC; - cmd->cmdsize = sizeof(typename T::command) + cmd->cmdsize = sizeof(typename T::command) + segInfo.sections.size() * sizeof(typename T::section); uint8_t *next = lc + cmd->cmdsize; setString16(seg.name, cmd->segname); @@ -567,7 +567,7 @@ error_code MachOFileLayout::writeSegmentLoadCommands(uint8_t *&lc) { if (_swap) swapStruct(*sect); ++sect; - } + } lc = reinterpret_cast<uint8_t*>(next); } // Add implicit __LINKEDIT segment @@ -605,7 +605,7 @@ error_code MachOFileLayout::writeLoadCommands() { st->cmd = LC_SYMTAB; st->cmdsize = sizeof(symtab_command); st->symoff = _startOfSymbols; - st->nsyms = _file.localSymbols.size() + _file.globalSymbols.size() + st->nsyms = _file.localSymbols.size() + _file.globalSymbols.size() + _file.undefinedSymbols.size(); st->stroff = _startOfSymbolStrings; st->strsize = _endOfSymbolStrings - _startOfSymbolStrings; @@ -617,7 +617,7 @@ error_code MachOFileLayout::writeLoadCommands() { ec = writeSegmentLoadCommands<MachO64Trait>(lc); else ec = writeSegmentLoadCommands<MachO32Trait>(lc); - + // Add LC_DYLD_INFO_ONLY. dyld_info_command* di = reinterpret_cast<dyld_info_command*>(lc); di->cmd = LC_DYLD_INFO_ONLY; @@ -641,14 +641,14 @@ error_code MachOFileLayout::writeLoadCommands() { st->cmd = LC_SYMTAB; st->cmdsize = sizeof(symtab_command); st->symoff = _startOfSymbols; - st->nsyms = _file.localSymbols.size() + _file.globalSymbols.size() + st->nsyms = _file.localSymbols.size() + _file.globalSymbols.size() + _file.undefinedSymbols.size(); st->stroff = _startOfSymbolStrings; st->strsize = _endOfSymbolStrings - _startOfSymbolStrings; if (_swap) swapStruct(*st); lc += sizeof(symtab_command); - + // Add LC_DYSYMTAB if (_file.fileType != llvm::MachO::MH_PRELOAD) { dysymtab_command* dst = reinterpret_cast<dysymtab_command*>(lc); @@ -666,7 +666,7 @@ error_code MachOFileLayout::writeLoadCommands() { dst->nmodtab = 0; dst->extrefsymoff = 0; dst->nextrefsyms = 0; - dst->indirectsymoff = _startOfIndirectSymbols; + dst->indirectsymoff = _startOfIndirectSymbols; dst->nindirectsyms = _indirectSymbolTableCount; dst->extreloff = 0; dst->nextrel = 0; @@ -676,7 +676,7 @@ error_code MachOFileLayout::writeLoadCommands() { swapStruct(*dst); lc += sizeof(dysymtab_command); } - + // If main executable, add LC_LOAD_DYLINKER and LC_MAIN. if (_file.fileType == llvm::MachO::MH_EXECUTE) { // Build LC_LOAD_DYLINKER load command. @@ -700,7 +700,7 @@ error_code MachOFileLayout::writeLoadCommands() { swapStruct(*ep); lc += sizeof(entry_point_command); } - + // Add LC_LOAD_DYLIB commands for (const DependentDylib &dep : _file.dependentDylibs) { dylib_command* dc = reinterpret_cast<dylib_command*>(lc); @@ -717,7 +717,7 @@ error_code MachOFileLayout::writeLoadCommands() { lc[sizeof(dylib_command)+dep.path.size()] = '\0'; lc += size; } - + } return ec; } @@ -818,12 +818,12 @@ void MachOFileLayout::writeRebaseInfo() { } void MachOFileLayout::writeBindingInfo() { - memcpy(&_buffer[_startOfBindingInfo], + memcpy(&_buffer[_startOfBindingInfo], _bindingInfo.bytes(), _bindingInfo.size()); } void MachOFileLayout::writeLazyBindingInfo() { - memcpy(&_buffer[_startOfLazyBindingInfo], + memcpy(&_buffer[_startOfLazyBindingInfo], _lazyBindingInfo.bytes(), _lazyBindingInfo.size()); } @@ -842,12 +842,12 @@ void MachOFileLayout::buildRebaseInfo() { // TODO: compress rebasing info. for (const RebaseLocation& entry : _file.rebasingInfo) { _rebaseInfo.append_byte(REBASE_OPCODE_SET_TYPE_IMM | entry.kind); - _rebaseInfo.append_byte(REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB + _rebaseInfo.append_byte(REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB | entry.segIndex); _rebaseInfo.append_uleb128(entry.segOffset); _rebaseInfo.append_uleb128(REBASE_OPCODE_DO_REBASE_IMM_TIMES | 1); } - _rebaseInfo.append_byte(REBASE_OPCODE_DONE); + _rebaseInfo.append_byte(REBASE_OPCODE_DONE); _rebaseInfo.align(_is64 ? 8 : 4); } @@ -855,7 +855,7 @@ void MachOFileLayout::buildBindInfo() { // TODO: compress bind info. for (const BindLocation& entry : _file.bindingInfo) { _bindingInfo.append_byte(BIND_OPCODE_SET_TYPE_IMM | entry.kind); - _bindingInfo.append_byte(BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB + _bindingInfo.append_byte(BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB | entry.segIndex); _bindingInfo.append_uleb128(entry.segOffset); _bindingInfo.append_byte(BIND_OPCODE_SET_DYLIB_ORDINAL_IMM | entry.ordinal); @@ -867,14 +867,14 @@ void MachOFileLayout::buildBindInfo() { } _bindingInfo.append_byte(BIND_OPCODE_DO_BIND); } - _bindingInfo.append_byte(BIND_OPCODE_DONE); + _bindingInfo.append_byte(BIND_OPCODE_DONE); _bindingInfo.align(_is64 ? 8 : 4); } void MachOFileLayout::buildLazyBindInfo() { for (const BindLocation& entry : _file.lazyBindingInfo) { _lazyBindingInfo.append_byte(BIND_OPCODE_SET_TYPE_IMM | entry.kind); - _lazyBindingInfo.append_byte(BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB + _lazyBindingInfo.append_byte(BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB | entry.segIndex); _lazyBindingInfo.append_uleb128(entry.segOffset); _lazyBindingInfo.append_byte(BIND_OPCODE_SET_DYLIB_ORDINAL_IMM | entry.ordinal); @@ -882,17 +882,17 @@ void MachOFileLayout::buildLazyBindInfo() { _lazyBindingInfo.append_string(entry.symbolName); _lazyBindingInfo.append_byte(BIND_OPCODE_DO_BIND); } - _lazyBindingInfo.append_byte(BIND_OPCODE_DONE); + _lazyBindingInfo.append_byte(BIND_OPCODE_DONE); _lazyBindingInfo.align(_is64 ? 8 : 4); } void MachOFileLayout::computeSymbolTableSizes() { // MachO symbol tables have three ranges: locals, globals, and undefines const size_t nlistSize = (_is64 ? sizeof(nlist_64) : sizeof(nlist)); - _symbolTableSize = nlistSize * (_file.localSymbols.size() + _symbolTableSize = nlistSize * (_file.localSymbols.size() + _file.globalSymbols.size() + _file.undefinedSymbols.size()); - _symbolStringPoolSize = 0; + _symbolStringPoolSize = 0; for (const Symbol &sym : _file.localSymbols) { _symbolStringPoolSize += (sym.name.size()+1); } @@ -904,7 +904,7 @@ void MachOFileLayout::computeSymbolTableSizes() { } _symbolTableLocalsStartIndex = 0; _symbolTableGlobalsStartIndex = _file.localSymbols.size(); - _symbolTableUndefinesStartIndex = _symbolTableGlobalsStartIndex + _symbolTableUndefinesStartIndex = _symbolTableGlobalsStartIndex + _file.globalSymbols.size(); _indirectSymbolTableCount = 0; @@ -941,7 +941,7 @@ error_code MachOFileLayout::writeBinary(StringRef path) { ec = llvm::FileOutputBuffer::create(path, size(), fob, flags); if (ec) return ec; - + // Write content. _buffer = fob->getBufferStart(); writeMachHeader(); @@ -958,7 +958,7 @@ error_code MachOFileLayout::writeBinary(StringRef path) { /// Takes in-memory normalized view and writes a mach-o object file. -error_code +error_code writeBinary(const NormalizedFile &file, StringRef path) { MachOFileLayout layout(file); return layout.writeBinary(path); diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp index f671ff8c768..1c333b94257 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp @@ -16,9 +16,9 @@ /// ^ /// | /// | -/// +-------+ +/// +-------+ /// | Atoms | -/// +-------+ +/// +-------+ #include "MachONormalizedFile.h" #include "ReferenceKinds.h" @@ -53,7 +53,7 @@ struct AtomInfo { struct SectionInfo { SectionInfo(StringRef seg, StringRef sect, SectionType type, uint32_t attr=0); - + StringRef segmentName; StringRef sectionName; SectionType type; @@ -66,15 +66,15 @@ struct SectionInfo { uint32_t finalSectionIndex; }; -SectionInfo::SectionInfo(StringRef sg, StringRef sct, SectionType t, uint32_t a) - : segmentName(sg), sectionName(sct), type(t), attributes(a), - address(0), size(0), alignment(0), +SectionInfo::SectionInfo(StringRef sg, StringRef sct, SectionType t, uint32_t a) + : segmentName(sg), sectionName(sct), type(t), attributes(a), + address(0), size(0), alignment(0), normalizedSectionIndex(0), finalSectionIndex(0) { } struct SegmentInfo { SegmentInfo(StringRef name); - + StringRef name; uint64_t address; uint64_t size; @@ -82,7 +82,7 @@ struct SegmentInfo { std::vector<SectionInfo*> sections; }; -SegmentInfo::SegmentInfo(StringRef n) +SegmentInfo::SegmentInfo(StringRef n) : name(n), address(0), size(0), access(0) { } @@ -108,10 +108,10 @@ public: private: typedef std::map<DefinedAtom::ContentType, SectionInfo*> TypeToSection; typedef llvm::DenseMap<const Atom*, uint64_t> AtomToAddress; - + struct DylibInfo { int ordinal; bool hasWeak; bool hasNonWeak; }; typedef llvm::StringMap<DylibInfo> DylibPathToInfo; - + SectionInfo *sectionForAtom(const DefinedAtom*); SectionInfo *makeSection(DefinedAtom::ContentType); void appendAtom(SectionInfo *sect, const DefinedAtom *atom); @@ -121,15 +121,15 @@ private: void copySectionContent(SectionInfo *si, ContentBytes &content); uint8_t scopeBits(const DefinedAtom* atom); int dylibOrdinal(const SharedLibraryAtom *sa); - void segIndexForSection(const SectionInfo *sect, + void segIndexForSection(const SectionInfo *sect, uint8_t &segmentIndex, uint64_t &segmentStartAddr); const Atom *targetOfLazyPointer(const DefinedAtom *lpAtom); const Atom *targetOfStub(const DefinedAtom *stubAtom); bool belongsInGlobalSymbolsSection(const DefinedAtom* atom); void appendSection(SectionInfo *si, NormalizedFile &file); - void appendReloc(const DefinedAtom *atom, const Reference *ref, + void appendReloc(const DefinedAtom *atom, const Reference *ref, Relocations &relocations); - + static uint64_t alignTo(uint64_t value, uint8_t align2); typedef llvm::DenseMap<const Atom*, uint32_t> AtomToIndex; struct AtomAndIndex { const Atom *atom; uint32_t index; }; @@ -160,7 +160,7 @@ SectionInfo *Util::makeSection(DefinedAtom::ContentType type) { switch ( type ) { case DefinedAtom::typeCode: return new (_allocator) SectionInfo("__TEXT", "__text", - S_REGULAR, S_ATTR_PURE_INSTRUCTIONS + S_REGULAR, S_ATTR_PURE_INSTRUCTIONS | S_ATTR_SOME_INSTRUCTIONS); case DefinedAtom::typeCString: return new (_allocator) SectionInfo("__TEXT", "__cstring", @@ -195,7 +195,7 @@ SectionInfo *Util::sectionForAtom(const DefinedAtom *atom) { _sectionMap[type] = si; return si; } - + void Util::appendAtom(SectionInfo *sect, const DefinedAtom *atom) { // Figure out offset for atom in this section given alignment constraints. @@ -250,7 +250,7 @@ unsigned Util::SegmentSorter::weight(const SegmentInfo *seg) { .Default(100); } -bool Util::SegmentSorter::operator()(const SegmentInfo *left, +bool Util::SegmentSorter::operator()(const SegmentInfo *left, const SegmentInfo *right) { return (weight(left) < weight(right)); } @@ -267,7 +267,7 @@ unsigned Util::TextSectionSorter::weight(const SectionInfo *sect) { .Default(10); } -bool Util::TextSectionSorter::operator()(const SectionInfo *left, +bool Util::TextSectionSorter::operator()(const SectionInfo *left, const SectionInfo *right) { return (weight(left) < weight(right)); } @@ -291,15 +291,15 @@ void Util::organizeSections() { } // Sort segments. std::sort(_segmentInfos.begin(), _segmentInfos.end(), SegmentSorter()); - + // Sort sections within segments. for (SegmentInfo *seg : _segmentInfos) { if (seg->name.equals("__TEXT")) { - std::sort(seg->sections.begin(), seg->sections.end(), + std::sort(seg->sections.begin(), seg->sections.end(), TextSectionSorter()); } } - + // Record final section indexes. uint32_t sectionIndex = 1; for (SegmentInfo *seg : _segmentInfos) { @@ -331,7 +331,7 @@ void Util::layoutSectionsInTextSegment(SegmentInfo *seg, uint64_t &addr) { seg->address = addr; // Walks sections starting at end to calculate padding for start. int64_t taddr = 0; - for (auto it = seg->sections.rbegin(); it != seg->sections.rend(); ++it) { + for (auto it = seg->sections.rbegin(); it != seg->sections.rend(); ++it) { SectionInfo *sect = *it; taddr -= sect->size; taddr = taddr & (0 - (1 << sect->alignment)); @@ -362,17 +362,17 @@ void Util::assignAddressesToSections() { else layoutSectionsInSegment(seg, address); } - DEBUG_WITH_TYPE("WriterMachO-norm", + DEBUG_WITH_TYPE("WriterMachO-norm", llvm::dbgs() << "assignAddressesToSections()\n"; for (SegmentInfo *sgi : _segmentInfos) { llvm::dbgs() << " address=" << llvm::format("0x%08llX", sgi->address) << ", size=" << llvm::format("0x%08llX", sgi->size) - << ", segment-name='" << sgi->name + << ", segment-name='" << sgi->name << "'\n"; for (SectionInfo *si : sgi->sections) { llvm::dbgs()<< " addr=" << llvm::format("0x%08llX", si->address) << ", size=" << llvm::format("0x%08llX", si->size) - << ", section-name='" << si->sectionName + << ", section-name='" << si->sectionName << "\n"; } } @@ -382,10 +382,10 @@ void Util::assignAddressesToSections() { sect->address = alignTo(address, sect->alignment); address = sect->address + sect->size; } - DEBUG_WITH_TYPE("WriterMachO-norm", + DEBUG_WITH_TYPE("WriterMachO-norm", llvm::dbgs() << "assignAddressesToSections()\n"; for (SectionInfo *si : _sectionInfos) { - llvm::dbgs() << " section=" << si->sectionName + llvm::dbgs() << " section=" << si->sectionName << " address= " << llvm::format("0x%08X", si->address) << " size= " << llvm::format("0x%08X", si->size) << "\n"; @@ -499,19 +499,19 @@ uint8_t Util::scopeBits(const DefinedAtom* atom) { llvm_unreachable("Unknown scope"); } -bool Util::AtomSorter::operator()(const AtomAndIndex &left, +bool Util::AtomSorter::operator()(const AtomAndIndex &left, const AtomAndIndex &right) { return (left.atom->name().compare(right.atom->name()) < 0); } - + bool Util::belongsInGlobalSymbolsSection(const DefinedAtom* atom) { return (atom->scope() == Atom::scopeGlobal); } void Util::addSymbols(const lld::File &atomFile, NormalizedFile &file) { // Mach-O symbol table has three regions: locals, globals, undefs. - + // Add all local (non-global) symbols in address order std::vector<AtomAndIndex> globals; globals.reserve(512); @@ -525,7 +525,7 @@ void Util::addSymbols(const lld::File &atomFile, NormalizedFile &file) { } else { Symbol sym; sym.name = atom->name(); - sym.type = N_SECT; + sym.type = N_SECT; sym.scope = scopeBits(atom); sym.sect = sect->finalSectionIndex; sym.desc = 0; @@ -535,21 +535,21 @@ void Util::addSymbols(const lld::File &atomFile, NormalizedFile &file) { } } } - + // Sort global symbol alphabetically, then add to symbol table. std::sort(globals.begin(), globals.end(), AtomSorter()); for (AtomAndIndex &ai : globals) { Symbol sym; sym.name = ai.atom->name(); - sym.type = N_SECT; + sym.type = N_SECT; sym.scope = scopeBits(static_cast<const DefinedAtom*>(ai.atom)); sym.sect = ai.index; sym.desc = 0; sym.value = _atomToAddress[ai.atom]; file.globalSymbols.push_back(sym); } - - + + // Sort undefined symbol alphabetically, then add to symbol table. std::vector<AtomAndIndex> undefs; undefs.reserve(128); @@ -566,7 +566,7 @@ void Util::addSymbols(const lld::File &atomFile, NormalizedFile &file) { for (AtomAndIndex &ai : undefs) { Symbol sym; sym.name = ai.atom->name(); - sym.type = N_UNDF; + sym.type = N_UNDF; sym.scope = N_EXT; sym.sect = 0; sym.desc = 0; @@ -690,7 +690,7 @@ void Util::segIndexForSection(const SectionInfo *sect, uint8_t &segmentIndex, uint64_t &segmentStartAddr) { segmentIndex = 0; for (const SegmentInfo *seg : _segmentInfos) { - if ((seg->address <= sect->address) + if ((seg->address <= sect->address) && (seg->address+seg->size >= sect->address+sect->size)) { segmentStartAddr = seg->address; return; @@ -701,7 +701,7 @@ void Util::segIndexForSection(const SectionInfo *sect, uint8_t &segmentIndex, } -void Util::appendReloc(const DefinedAtom *atom, const Reference *ref, +void Util::appendReloc(const DefinedAtom *atom, const Reference *ref, Relocations &relocations) { // TODO: convert Reference to normalized relocation } @@ -709,7 +709,7 @@ void Util::appendReloc(const DefinedAtom *atom, const Reference *ref, void Util::addSectionRelocs(const lld::File &, NormalizedFile &file) { if (_context.outputFileType() != llvm::MachO::MH_OBJECT) return; - + for (SectionInfo *si : _sectionInfos) { Section &normSect = file.sections[si->normalizedSectionIndex]; for (const AtomInfo &info : si->atomsAndOffsets) { @@ -721,7 +721,7 @@ void Util::addSectionRelocs(const lld::File &, NormalizedFile &file) { } } -void Util::addRebaseAndBindingInfo(const lld::File &atomFile, +void Util::addRebaseAndBindingInfo(const lld::File &atomFile, NormalizedFile &nFile) { if (_context.outputFileType() == llvm::MachO::MH_OBJECT) return; @@ -733,7 +733,7 @@ void Util::addRebaseAndBindingInfo(const lld::File &atomFile, for (const AtomInfo &info : sect->atomsAndOffsets) { const DefinedAtom *atom = info.atom; for (const Reference *ref : *atom) { - uint64_t segmentOffset = _atomToAddress[atom] + ref->offsetInAtom() + uint64_t segmentOffset = _atomToAddress[atom] + ref->offsetInAtom() - segmentStartAddr; const Atom* targ = ref->target(); if (_context.kindHandler().isPointer(*ref)) { @@ -753,7 +753,7 @@ void Util::addRebaseAndBindingInfo(const lld::File &atomFile, bind.kind = llvm::MachO::BIND_TYPE_POINTER; bind.canBeNull = sa->canBeNullAtRuntime(); bind.ordinal = dylibOrdinal(sa); - bind.symbolName = targ->name(); + bind.symbolName = targ->name(); bind.addend = ref->addend(); nFile.bindingInfo.push_back(bind); } @@ -765,7 +765,7 @@ void Util::addRebaseAndBindingInfo(const lld::File &atomFile, bind.kind = llvm::MachO::BIND_TYPE_POINTER; bind.canBeNull = false; //sa->canBeNullAtRuntime(); bind.ordinal = 1; - bind.symbolName = targ->name(); + bind.symbolName = targ->name(); bind.addend = ref->addend(); nFile.lazyBindingInfo.push_back(bind); } @@ -786,16 +786,16 @@ namespace mach_o { namespace normalized { /// Convert a set of Atoms into a normalized mach-o file. -ErrorOr<std::unique_ptr<NormalizedFile>> -normalizedFromAtoms(const lld::File &atomFile, +ErrorOr<std::unique_ptr<NormalizedFile>> +normalizedFromAtoms(const lld::File &atomFile, const MachOLinkingContext &context) { - // The util object buffers info until the normalized file can be made. + // The util object buffers info until the normalized file can be made. Util util(context); util.assignAtomsToSections(atomFile); util.organizeSections(); util.assignAddressesToSections(); util.buildAtomToAddressMap(); - + std::unique_ptr<NormalizedFile> f(new NormalizedFile()); NormalizedFile &normFile = *f.get(); f->arch = context.arch(); @@ -809,7 +809,7 @@ normalizedFromAtoms(const lld::File &atomFile, util.addRebaseAndBindingInfo(atomFile, normFile); util.addSectionRelocs(atomFile, normFile); util.copyEntryPointAddress(normFile); - + return std::move(f); } diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp index 5a5a9449158..766cdf8696c 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp @@ -11,9 +11,9 @@ /// \file For mach-o object files, this implementation uses YAML I/O to /// provide the convert between YAML and the normalized mach-o (NM). /// -/// +------------+ +------+ -/// | normalized | <-> | yaml | -/// +------------+ +------+ +/// +------------+ +------+ +/// | normalized | <-> | yaml | +/// +------------+ +------+ #include "MachONormalizedFile.h" @@ -138,13 +138,13 @@ struct ScalarEnumerationTraits<lld::MachOLinkingContext::Arch> { template <> struct ScalarEnumerationTraits<lld::MachOLinkingContext::OS> { static void enumeration(IO &io, lld::MachOLinkingContext::OS &value) { - io.enumCase(value, "unknown", + io.enumCase(value, "unknown", lld::MachOLinkingContext::OS::unknown); - io.enumCase(value, "Mac OS X", + io.enumCase(value, "Mac OS X", lld::MachOLinkingContext::OS::macOSX); - io.enumCase(value, "iOS", + io.enumCase(value, "iOS", lld::MachOLinkingContext::OS::iOS); - io.enumCase(value, "iOS Simulator", + io.enumCase(value, "iOS Simulator", lld::MachOLinkingContext::OS::iOS_simulator); } }; @@ -164,9 +164,9 @@ struct ScalarEnumerationTraits<HeaderFileType> { template <> struct ScalarBitSetTraits<FileFlags> { static void bitset(IO &io, FileFlags &value) { - io.bitSetCase(value, "MH_TWOLEVEL", + io.bitSetCase(value, "MH_TWOLEVEL", llvm::MachO::MH_TWOLEVEL); - io.bitSetCase(value, "MH_SUBSECTIONS_VIA_SYMBOLS", + io.bitSetCase(value, "MH_SUBSECTIONS_VIA_SYMBOLS", llvm::MachO::MH_SUBSECTIONS_VIA_SYMBOLS); } }; @@ -175,49 +175,49 @@ struct ScalarBitSetTraits<FileFlags> { template <> struct ScalarEnumerationTraits<SectionType> { static void enumeration(IO &io, SectionType &value) { - io.enumCase(value, "S_REGULAR", + io.enumCase(value, "S_REGULAR", llvm::MachO::S_REGULAR); - io.enumCase(value, "S_ZEROFILL", + io.enumCase(value, "S_ZEROFILL", llvm::MachO::S_ZEROFILL); - io.enumCase(value, "S_CSTRING_LITERALS", + io.enumCase(value, "S_CSTRING_LITERALS", llvm::MachO::S_CSTRING_LITERALS); - io.enumCase(value, "S_4BYTE_LITERALS", + io.enumCase(value, "S_4BYTE_LITERALS", llvm::MachO::S_4BYTE_LITERALS); - io.enumCase(value, "S_8BYTE_LITERALS", + io.enumCase(value, "S_8BYTE_LITERALS", llvm::MachO::S_8BYTE_LITERALS); - io.enumCase(value, "S_LITERAL_POINTERS", + io.enumCase(value, "S_LITERAL_POINTERS", llvm::MachO::S_LITERAL_POINTERS); - io.enumCase(value, "S_NON_LAZY_SYMBOL_POINTERS", + io.enumCase(value, "S_NON_LAZY_SYMBOL_POINTERS", llvm::MachO::S_NON_LAZY_SYMBOL_POINTERS); - io.enumCase(value, "S_LAZY_SYMBOL_POINTERS", + io.enumCase(value, "S_LAZY_SYMBOL_POINTERS", llvm::MachO::S_LAZY_SYMBOL_POINTERS); - io.enumCase(value, "S_SYMBOL_STUBS", + io.enumCase(value, "S_SYMBOL_STUBS", llvm::MachO::S_SYMBOL_STUBS); - io.enumCase(value, "S_MOD_INIT_FUNC_POINTERS", + io.enumCase(value, "S_MOD_INIT_FUNC_POINTERS", llvm::MachO::S_MOD_INIT_FUNC_POINTERS); - io.enumCase(value, "S_MOD_TERM_FUNC_POINTERS", + io.enumCase(value, "S_MOD_TERM_FUNC_POINTERS", llvm::MachO::S_MOD_TERM_FUNC_POINTERS); - io.enumCase(value, "S_COALESCED", + io.enumCase(value, "S_COALESCED", llvm::MachO::S_COALESCED); - io.enumCase(value, "S_GB_ZEROFILL", + io.enumCase(value, "S_GB_ZEROFILL", llvm::MachO::S_GB_ZEROFILL); - io.enumCase(value, "S_INTERPOSING", + io.enumCase(value, "S_INTERPOSING", llvm::MachO::S_INTERPOSING); - io.enumCase(value, "S_16BYTE_LITERALS", + io.enumCase(value, "S_16BYTE_LITERALS", llvm::MachO::S_16BYTE_LITERALS); - io.enumCase(value, "S_DTRACE_DOF", + io.enumCase(value, "S_DTRACE_DOF", llvm::MachO::S_DTRACE_DOF); - io.enumCase(value, "S_LAZY_DYLIB_SYMBOL_POINTERS", + io.enumCase(value, "S_LAZY_DYLIB_SYMBOL_POINTERS", llvm::MachO::S_LAZY_DYLIB_SYMBOL_POINTERS); - io.enumCase(value, "S_THREAD_LOCAL_REGULAR", + io.enumCase(value, "S_THREAD_LOCAL_REGULAR", llvm::MachO::S_THREAD_LOCAL_REGULAR); - io.enumCase(value, "S_THREAD_LOCAL_ZEROFILL", + io.enumCase(value, "S_THREAD_LOCAL_ZEROFILL", llvm::MachO::S_THREAD_LOCAL_ZEROFILL); - io.enumCase(value, "S_THREAD_LOCAL_VARIABLES", + io.enumCase(value, "S_THREAD_LOCAL_VARIABLES", llvm::MachO::S_THREAD_LOCAL_VARIABLES); - io.enumCase(value, "S_THREAD_LOCAL_VARIABLE_POINTERS", + io.enumCase(value, "S_THREAD_LOCAL_VARIABLE_POINTERS", llvm::MachO::S_THREAD_LOCAL_VARIABLE_POINTERS); - io.enumCase(value, "S_THREAD_LOCAL_INIT_FUNCTION_POINTERS", + io.enumCase(value, "S_THREAD_LOCAL_INIT_FUNCTION_POINTERS", llvm::MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS); } }; @@ -225,15 +225,15 @@ struct ScalarEnumerationTraits<SectionType> { template <> struct ScalarBitSetTraits<SectionAttr> { static void bitset(IO &io, SectionAttr &value) { - io.bitSetCase(value, "S_ATTR_PURE_INSTRUCTIONS", + io.bitSetCase(value, "S_ATTR_PURE_INSTRUCTIONS", llvm::MachO::S_ATTR_PURE_INSTRUCTIONS); - io.bitSetCase(value, "S_ATTR_SOME_INSTRUCTIONS", + io.bitSetCase(value, "S_ATTR_SOME_INSTRUCTIONS", llvm::MachO::S_ATTR_SOME_INSTRUCTIONS); - io.bitSetCase(value, "S_ATTR_NO_DEAD_STRIP", + io.bitSetCase(value, "S_ATTR_NO_DEAD_STRIP", llvm::MachO::S_ATTR_NO_DEAD_STRIP); - io.bitSetCase(value, "S_ATTR_EXT_RELOC", + io.bitSetCase(value, "S_ATTR_EXT_RELOC", llvm::MachO::S_ATTR_EXT_RELOC); - io.bitSetCase(value, "S_ATTR_LOC_RELOC", + io.bitSetCase(value, "S_ATTR_LOC_RELOC", llvm::MachO::S_ATTR_LOC_RELOC); } }; @@ -306,7 +306,7 @@ struct MappingTraits<Section> { std::copy(_normalizedContent.begin(), _normalizedContent.end(), bytes); return makeArrayRef(bytes, size); } - + IO &_io; ContentBytes _normalizedContent; }; @@ -340,57 +340,57 @@ struct ScalarEnumerationTraits<RelocationInfoType> { assert(file != nullptr); switch (file->arch) { case lld::MachOLinkingContext::arch_x86_64: - io.enumCase(value, "X86_64_RELOC_UNSIGNED", + io.enumCase(value, "X86_64_RELOC_UNSIGNED", llvm::MachO::X86_64_RELOC_UNSIGNED); - io.enumCase(value, "X86_64_RELOC_SIGNED", + io.enumCase(value, "X86_64_RELOC_SIGNED", llvm::MachO::X86_64_RELOC_SIGNED); - io.enumCase(value, "X86_64_RELOC_BRANCH", + io.enumCase(value, "X86_64_RELOC_BRANCH", llvm::MachO::X86_64_RELOC_BRANCH); - io.enumCase(value, "X86_64_RELOC_GOT_LOAD", + io.enumCase(value, "X86_64_RELOC_GOT_LOAD", llvm::MachO::X86_64_RELOC_GOT_LOAD); - io.enumCase(value, "X86_64_RELOC_GOT", + io.enumCase(value, "X86_64_RELOC_GOT", llvm::MachO::X86_64_RELOC_GOT); - io.enumCase(value, "X86_64_RELOC_SUBTRACTOR", + io.enumCase(value, "X86_64_RELOC_SUBTRACTOR", llvm::MachO::X86_64_RELOC_SUBTRACTOR); - io.enumCase(value, "X86_64_RELOC_SIGNED_1", + io.enumCase(value, "X86_64_RELOC_SIGNED_1", llvm::MachO::X86_64_RELOC_SIGNED_1); - io.enumCase(value, "X86_64_RELOC_SIGNED_2", + io.enumCase(value, "X86_64_RELOC_SIGNED_2", llvm::MachO::X86_64_RELOC_SIGNED_2); - io.enumCase(value, "X86_64_RELOC_SIGNED_4", + io.enumCase(value, "X86_64_RELOC_SIGNED_4", llvm::MachO::X86_64_RELOC_SIGNED_4); - io.enumCase(value, "X86_64_RELOC_TLV", + io.enumCase(value, "X86_64_RELOC_TLV", llvm::MachO::X86_64_RELOC_TLV); break; case lld::MachOLinkingContext::arch_x86: - io.enumCase(value, "GENERIC_RELOC_VANILLA", + io.enumCase(value, "GENERIC_RELOC_VANILLA", llvm::MachO::GENERIC_RELOC_VANILLA); - io.enumCase(value, "GENERIC_RELOC_PAIR", + io.enumCase(value, "GENERIC_RELOC_PAIR", llvm::MachO::GENERIC_RELOC_PAIR); - io.enumCase(value, "GENERIC_RELOC_SECTDIFF", + io.enumCase(value, "GENERIC_RELOC_SECTDIFF", llvm::MachO::GENERIC_RELOC_SECTDIFF); - io.enumCase(value, "GENERIC_RELOC_LOCAL_SECTDIFF", + io.enumCase(value, "GENERIC_RELOC_LOCAL_SECTDIFF", llvm::MachO::GENERIC_RELOC_LOCAL_SECTDIFF); - io.enumCase(value, "GENERIC_RELOC_TLV", + io.enumCase(value, "GENERIC_RELOC_TLV", llvm::MachO::GENERIC_RELOC_TLV); break; case lld::MachOLinkingContext::arch_armv6: case lld::MachOLinkingContext::arch_armv7: case lld::MachOLinkingContext::arch_armv7s: - io.enumCase(value, "ARM_RELOC_VANILLA", + io.enumCase(value, "ARM_RELOC_VANILLA", llvm::MachO::ARM_RELOC_VANILLA); - io.enumCase(value, "ARM_RELOC_PAIR", + io.enumCase(value, "ARM_RELOC_PAIR", llvm::MachO::ARM_RELOC_PAIR); - io.enumCase(value, "ARM_RELOC_SECTDIFF", + io.enumCase(value, "ARM_RELOC_SECTDIFF", llvm::MachO::ARM_RELOC_SECTDIFF); - io.enumCase(value, "ARM_RELOC_LOCAL_SECTDIFF", + io.enumCase(value, "ARM_RELOC_LOCAL_SECTDIFF", llvm::MachO::ARM_RELOC_LOCAL_SECTDIFF); - io.enumCase(value, "ARM_RELOC_BR24", + io.enumCase(value, "ARM_RELOC_BR24", llvm::MachO::ARM_RELOC_BR24); - io.enumCase(value, "ARM_THUMB_RELOC_BR22", + io.enumCase(value, "ARM_THUMB_RELOC_BR22", llvm::MachO::ARM_THUMB_RELOC_BR22); - io.enumCase(value, "ARM_RELOC_HALF", + io.enumCase(value, "ARM_RELOC_HALF", llvm::MachO::ARM_RELOC_HALF); - io.enumCase(value, "ARM_RELOC_HALF_SECTDIFF", + io.enumCase(value, "ARM_RELOC_HALF_SECTDIFF", llvm::MachO::ARM_RELOC_HALF_SECTDIFF); break; default: @@ -470,15 +470,15 @@ struct MappingTraits<Segment> { template <> struct ScalarEnumerationTraits<LoadCommandType> { static void enumeration(IO &io, LoadCommandType &value) { - io.enumCase(value, "LC_LOAD_DYLIB", + io.enumCase(value, "LC_LOAD_DYLIB", llvm::MachO::LC_LOAD_DYLIB); - io.enumCase(value, "LC_LOAD_WEAK_DYLIB", + io.enumCase(value, "LC_LOAD_WEAK_DYLIB", llvm::MachO::LC_LOAD_WEAK_DYLIB); - io.enumCase(value, "LC_REEXPORT_DYLIB", + io.enumCase(value, "LC_REEXPORT_DYLIB", llvm::MachO::LC_REEXPORT_DYLIB); - io.enumCase(value, "LC_LOAD_UPWARD_DYLIB", + io.enumCase(value, "LC_LOAD_UPWARD_DYLIB", llvm::MachO::LC_LOAD_UPWARD_DYLIB); - io.enumCase(value, "LC_LAZY_LOAD_DYLIB", + io.enumCase(value, "LC_LAZY_LOAD_DYLIB", llvm::MachO::LC_LAZY_LOAD_DYLIB); } }; @@ -495,11 +495,11 @@ struct MappingTraits<DependentDylib> { template <> struct ScalarEnumerationTraits<RebaseType> { static void enumeration(IO &io, RebaseType &value) { - io.enumCase(value, "REBASE_TYPE_POINTER", + io.enumCase(value, "REBASE_TYPE_POINTER", llvm::MachO::REBASE_TYPE_POINTER); - io.enumCase(value, "REBASE_TYPE_TEXT_PCREL32", + io.enumCase(value, "REBASE_TYPE_TEXT_PCREL32", llvm::MachO::REBASE_TYPE_TEXT_PCREL32); - io.enumCase(value, "REBASE_TYPE_TEXT_ABSOLUTE32", + io.enumCase(value, "REBASE_TYPE_TEXT_ABSOLUTE32", llvm::MachO::REBASE_TYPE_TEXT_ABSOLUTE32); } }; @@ -510,7 +510,7 @@ struct MappingTraits<RebaseLocation> { static void mapping(IO &io, RebaseLocation& rebase) { io.mapRequired("segment-index", rebase.segIndex); io.mapRequired("segment-offset", rebase.segOffset); - io.mapOptional("kind", rebase.kind, + io.mapOptional("kind", rebase.kind, llvm::MachO::REBASE_TYPE_POINTER); } }; @@ -520,11 +520,11 @@ struct MappingTraits<RebaseLocation> { template <> struct ScalarEnumerationTraits<BindType> { static void enumeration(IO &io, BindType &value) { - io.enumCase(value, "BIND_TYPE_POINTER", + io.enumCase(value, "BIND_TYPE_POINTER", llvm::MachO::BIND_TYPE_POINTER); - io.enumCase(value, "BIND_TYPE_TEXT_ABSOLUTE32", + io.enumCase(value, "BIND_TYPE_TEXT_ABSOLUTE32", llvm::MachO::BIND_TYPE_TEXT_ABSOLUTE32); - io.enumCase(value, "BIND_TYPE_TEXT_PCREL32", + io.enumCase(value, "BIND_TYPE_TEXT_PCREL32", llvm::MachO::BIND_TYPE_TEXT_PCREL32); } }; @@ -534,7 +534,7 @@ struct MappingTraits<BindLocation> { static void mapping(IO &io, BindLocation &bind) { io.mapRequired("segment-index", bind.segIndex); io.mapRequired("segment-offset", bind.segOffset); - io.mapOptional("kind", bind.kind, + io.mapOptional("kind", bind.kind, llvm::MachO::BIND_TYPE_POINTER); io.mapOptional("can-be-null", bind.canBeNull, false); io.mapRequired("ordinal", bind.ordinal); @@ -547,9 +547,9 @@ struct MappingTraits<BindLocation> { template <> struct ScalarEnumerationTraits<ExportSymbolKind> { static void enumeration(IO &io, ExportSymbolKind &value) { - io.enumCase(value, "EXPORT_SYMBOL_FLAGS_KIND_REGULAR", + io.enumCase(value, "EXPORT_SYMBOL_FLAGS_KIND_REGULAR", llvm::MachO::EXPORT_SYMBOL_FLAGS_KIND_REGULAR); - io.enumCase(value, "EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCALl", + io.enumCase(value, "EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCALl", llvm::MachO::EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL); } }; @@ -557,11 +557,11 @@ struct ScalarEnumerationTraits<ExportSymbolKind> { template <> struct ScalarBitSetTraits<ExportFlags> { static void bitset(IO &io, ExportFlags &value) { - io.bitSetCase(value, "EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION", + io.bitSetCase(value, "EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION", llvm::MachO::EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION); - io.bitSetCase(value, "EXPORT_SYMBOL_FLAGS_REEXPORT", + io.bitSetCase(value, "EXPORT_SYMBOL_FLAGS_REEXPORT", llvm::MachO::EXPORT_SYMBOL_FLAGS_REEXPORT); - io.bitSetCase(value, "EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER", + io.bitSetCase(value, "EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER", llvm::MachO::EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER); } }; @@ -572,7 +572,7 @@ struct MappingTraits<Export> { static void mapping(IO &io, Export &exp) { io.mapRequired("name", exp.name); io.mapRequired("offset", exp.offset); - io.mapOptional("kind", exp.kind, + io.mapOptional("kind", exp.kind, llvm::MachO::EXPORT_SYMBOL_FLAGS_KIND_REGULAR); io.mapOptional("flags", exp.flags); io.mapOptional("other-offset", exp.otherOffset, Hex32(0)); @@ -619,7 +619,7 @@ struct MappingTraits<NormalizedFile> { namespace lld { namespace mach_o { -/// Handles !mach-o tagged yaml documents. +/// Handles !mach-o tagged yaml documents. bool MachOYamlIOTaggedDocumentHandler::handledDocTag(llvm::yaml::IO &io, const lld::File *&file) const { if (!io.mapTag("!mach-o")) diff --git a/lld/lib/ReaderWriter/MachO/StubAtoms.hpp b/lld/lib/ReaderWriter/MachO/StubAtoms.hpp index ae0707f7835..daf7e7b3d0a 100644 --- a/lld/lib/ReaderWriter/MachO/StubAtoms.hpp +++ b/lld/lib/ReaderWriter/MachO/StubAtoms.hpp @@ -31,9 +31,9 @@ namespace mach_o { // class StubBinderAtom : public SharedLibraryAtom { public: - StubBinderAtom(const File &f) : _file(f) { + StubBinderAtom(const File &f) : _file(f) { } - + virtual const File& file() const { return _file; } @@ -45,7 +45,7 @@ public: virtual StringRef loadName() const { return StringRef("/usr/lib/libSystem.B.dylib"); } - + virtual bool canBeNullAtRuntime() const { return false; } @@ -57,15 +57,15 @@ public: virtual uint64_t size() const LLVM_OVERRIDE { return 0; } - + private: const File &_file; }; -} // namespace mach_o -} // namespace lld +} // namespace mach_o +} // namespace lld #endif // LLD_READER_WRITER_MACHO_STUB_ATOMS_H diff --git a/lld/lib/ReaderWriter/MachO/WriterMachO.cpp b/lld/lib/ReaderWriter/MachO/WriterMachO.cpp index 009818a6798..b223387473c 100644 --- a/lld/lib/ReaderWriter/MachO/WriterMachO.cpp +++ b/lld/lib/ReaderWriter/MachO/WriterMachO.cpp @@ -34,18 +34,18 @@ public: virtual error_code writeFile(const lld::File &file, StringRef path) { // Construct empty normalized file from atoms. - ErrorOr<std::unique_ptr<NormalizedFile>> nFile = + ErrorOr<std::unique_ptr<NormalizedFile>> nFile = normalized::normalizedFromAtoms(file, _context); if (error_code ec = nFile.getError()) return ec; - + // For debugging, write out yaml form of normalized file. //writeYaml(*nFile->get(), llvm::errs()); - + // Write normalized file as mach-o binary. return writeBinary(*nFile->get(), path); } - + virtual bool createImplicitFiles(std::vector<std::unique_ptr<File> > &r) { if (_context.outputFileType() == llvm::MachO::MH_EXECUTE) { // When building main executables, add _main as required entry point. diff --git a/lld/lib/ReaderWriter/Reader.cpp b/lld/lib/ReaderWriter/Reader.cpp index 35affd78e2b..16eb7a0fa4e 100644 --- a/lld/lib/ReaderWriter/Reader.cpp +++ b/lld/lib/ReaderWriter/Reader.cpp @@ -64,7 +64,7 @@ Registry::Registry() { kindStrings); } -bool Registry::handleTaggedDoc(llvm::yaml::IO &io, +bool Registry::handleTaggedDoc(llvm::yaml::IO &io, const lld::File *&file) const { for (const std::unique_ptr<YamlIOTaggedDocumentHandler> &h : _yamlHandlers) { if (h->handledDocTag(io, file)) diff --git a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp index 6825b76bee7..fab9e9100fc 100644 --- a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp +++ b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp @@ -150,7 +150,7 @@ private: typedef llvm::StringMap<const lld::Atom *> NameToAtom; typedef llvm::DenseMap<const lld::Atom *, std::string> AtomToRefName; - // Allocate a new copy of this string in _storage, so the strings + // Allocate a new copy of this string in _storage, so the strings // can be freed when RefNameBuilder is destroyed. StringRef copyString(StringRef str) { char *s = _storage.Allocate<char>(str.size()); @@ -635,7 +635,7 @@ template <> struct MappingTraits<const lld::File *> { return _absoluteAtoms; } - // Allocate a new copy of this string in _storage, so the strings + // Allocate a new copy of this string in _storage, so the strings // can be freed when File is destroyed. StringRef copyString(StringRef str) { char *s = _storage.Allocate<char>(str.size()); @@ -659,7 +659,7 @@ template <> struct MappingTraits<const lld::File *> { // Let any register tag handler process this. if (info->_registry && info->_registry->handleTaggedDoc(io, file)) return; - // If no registered handler claims this tag and there is no tag, + // If no registered handler claims this tag and there is no tag, // grandfather in as "!native". if (io.mapTag("!native", true) || io.mapTag("tag:yaml.org,2002:map")) mappingAtoms(io, file); @@ -890,7 +890,7 @@ template <> struct MappingTraits<const lld::DefinedAtom *> { io.mapOptional("ref-name", keys->_refName, StringRef()); io.mapOptional("scope", keys->_scope, DefinedAtom::scopeTranslationUnit); - io.mapOptional("type", keys->_contentType, + io.mapOptional("type", keys->_contentType, DefinedAtom::typeCode); io.mapOptional("content", keys->_content); io.mapOptional("size", keys->_size, (uint64_t)keys->_content.size()); diff --git a/lld/test/Driver/undef-basic.objtxt b/lld/test/Driver/undef-basic.objtxt index 381195ada17..f942d5c8e90 100644 --- a/lld/test/Driver/undef-basic.objtxt +++ b/lld/test/Driver/undef-basic.objtxt @@ -9,7 +9,7 @@ absolute-atoms: - name: putchar value: 0xFFFF0040 - + - name: reset value: 0xFFFF0080 diff --git a/lld/test/core/absolute-basic.objtxt b/lld/test/core/absolute-basic.objtxt index b13e2ac1d0a..af64794514a 100644 --- a/lld/test/core/absolute-basic.objtxt +++ b/lld/test/core/absolute-basic.objtxt @@ -8,14 +8,14 @@ absolute-atoms: - name: putchar value: 0xFFFF0040 - + - name: reset value: 0xFFFF0080 ... -# CHECK: absolute-atoms: +# CHECK: absolute-atoms: # CHECK: name: putchar # CHECK: value: 0x00000000FFFF0040 # CHECK: name: reset diff --git a/lld/test/core/archive-chain.objtxt b/lld/test/core/archive-chain.objtxt index 0651dadd71c..0f80985ec11 100644 --- a/lld/test/core/archive-chain.objtxt +++ b/lld/test/core/archive-chain.objtxt @@ -45,7 +45,7 @@ members: - name: baz1 scope: global type: code - + - name: baz1b type: code diff --git a/lld/test/core/auto-hide-coalesce.objtxt b/lld/test/core/auto-hide-coalesce.objtxt index 24b2e1c4e65..ad82d5afc57 100644 --- a/lld/test/core/auto-hide-coalesce.objtxt +++ b/lld/test/core/auto-hide-coalesce.objtxt @@ -10,17 +10,17 @@ defined-atoms: scope: global type: code merge: as-weak - + - name: _inlineFunc2 scope: global type: code merge: as-weak - + - name: _inlineFunc3 scope: global type: code merge: as-addressed-weak - + - name: _inlineFunc4 scope: global type: code @@ -31,17 +31,17 @@ defined-atoms: scope: global type: code merge: as-weak - + - name: _inlineFunc2 scope: global type: code merge: as-addressed-weak - + - name: _inlineFunc3 scope: global type: code merge: as-weak - + - name: _inlineFunc4 scope: global type: code diff --git a/lld/test/core/constants-coalesce.objtxt b/lld/test/core/constants-coalesce.objtxt index e64783720a7..a82f6800908 100644 --- a/lld/test/core/constants-coalesce.objtxt +++ b/lld/test/core/constants-coalesce.objtxt @@ -11,7 +11,7 @@ defined-atoms: type: constant merge: by-content content: [ 01, 02, 03, 04 ] - + - ref-name: L8-byte type: constant merge: by-content diff --git a/lld/test/core/cstring-coalesce.objtxt b/lld/test/core/cstring-coalesce.objtxt index 914740933ff..78986a08c64 100644 --- a/lld/test/core/cstring-coalesce.objtxt +++ b/lld/test/core/cstring-coalesce.objtxt @@ -10,7 +10,7 @@ defined-atoms: type: c-string merge: by-content content: [ 68, 65, 6c, 6c, 6f, 00 ] - + - ref-name: L1 type: c-string merge: by-content diff --git a/lld/test/core/custom-section.objtxt b/lld/test/core/custom-section.objtxt index faf4f4310d1..ce305e9af38 100644 --- a/lld/test/core/custom-section.objtxt +++ b/lld/test/core/custom-section.objtxt @@ -24,7 +24,7 @@ defined-atoms: # CHECK: name: _foo1 -# CHECK-NOT: section-name: +# CHECK-NOT: section-name: # CHECK: name: _foo2 # CHECK: section-choice: custom # CHECK: section-name: __foozle diff --git a/lld/test/core/dead-strip-basic.objtxt b/lld/test/core/dead-strip-basic.objtxt index 94af8e2b1df..64cd2291c76 100644 --- a/lld/test/core/dead-strip-basic.objtxt +++ b/lld/test/core/dead-strip-basic.objtxt @@ -17,7 +17,7 @@ defined-atoms: - offset: 6 kind: pcrel32 target: baz - + - name: mydead1 scope: global diff --git a/lld/test/core/dead-strip-globals.objtxt b/lld/test/core/dead-strip-globals.objtxt index 568eb71511d..8feb235d07c 100644 --- a/lld/test/core/dead-strip-globals.objtxt +++ b/lld/test/core/dead-strip-globals.objtxt @@ -16,7 +16,7 @@ defined-atoms: - offset: 6 kind: pcrel32 target: baz - + - name: myglobal1 scope: global diff --git a/lld/test/core/error-atom-attribute.objtxt b/lld/test/core/error-atom-attribute.objtxt index f3098e52a8e..6643aba29ee 100644 --- a/lld/test/core/error-atom-attribute.objtxt +++ b/lld/test/core/error-atom-attribute.objtxt @@ -11,7 +11,7 @@ defined-atoms: scope: hidden foobar: true dead-strip: never - + ... diff --git a/lld/test/core/error-atom-content-byte-value.objtxt b/lld/test/core/error-atom-content-byte-value.objtxt index e2447caeb52..6e675576461 100644 --- a/lld/test/core/error-atom-content-byte-value.objtxt +++ b/lld/test/core/error-atom-content-byte-value.objtxt @@ -10,7 +10,7 @@ defined-atoms: - name: entry scope: hidden content: [ A5, 00, 4G, 1F ] - + ... diff --git a/lld/test/core/error-atom-content-bytes.objtxt b/lld/test/core/error-atom-content-bytes.objtxt index e18a3bcb1a5..a8a82b2b45e 100644 --- a/lld/test/core/error-atom-content-bytes.objtxt +++ b/lld/test/core/error-atom-content-bytes.objtxt @@ -10,7 +10,7 @@ defined-atoms: - name: entry scope: hidden content: [ A5, 1234, 00, 4F ] - + ... diff --git a/lld/test/core/error-atom-type.objtxt b/lld/test/core/error-atom-type.objtxt index 80dd9a05b33..b0943f8e274 100644 --- a/lld/test/core/error-atom-type.objtxt +++ b/lld/test/core/error-atom-type.objtxt @@ -11,7 +11,7 @@ defined-atoms: scope: hidden type: superluminal dead-strip: never - + ... diff --git a/lld/test/core/error-atom-undefined-wrong-attribue.objtxt b/lld/test/core/error-atom-undefined-wrong-attribue.objtxt index 0ee1d275183..5cdd8519c80 100644 --- a/lld/test/core/error-atom-undefined-wrong-attribue.objtxt +++ b/lld/test/core/error-atom-undefined-wrong-attribue.objtxt @@ -9,7 +9,7 @@ undefined-atoms: - name: foo type: code - + ... diff --git a/lld/test/core/error-file-attribute.objtxt b/lld/test/core/error-file-attribute.objtxt index 6897dc91e5a..d8393dc5e40 100644 --- a/lld/test/core/error-file-attribute.objtxt +++ b/lld/test/core/error-file-attribute.objtxt @@ -10,7 +10,7 @@ aardvark: true defined-atoms: - name: entry scope: hidden - + ... diff --git a/lld/test/core/fixups-addend.objtxt b/lld/test/core/fixups-addend.objtxt index 24af91ffa7c..d976150459c 100644 --- a/lld/test/core/fixups-addend.objtxt +++ b/lld/test/core/fixups-addend.objtxt @@ -8,7 +8,7 @@ defined-atoms: - name: foo type: code - content: [ 48, 8D, 3D, 00, 00, 00, 00, + content: [ 48, 8D, 3D, 00, 00, 00, 00, 48, 8D, 3D, 00, 00, 00, 00 ] references: - offset: 3 @@ -19,10 +19,10 @@ defined-atoms: kind: pcrel32 target: bar addend: -50 - + - name: func type: code - content: [ 48, 8D, 3D, 00, 00, 00, 00, + content: [ 48, 8D, 3D, 00, 00, 00, 00, 48, 8D, 3D, 00, 00, 00, 00 ] references: - offset: 3 @@ -33,11 +33,11 @@ defined-atoms: kind: pcrel32 target: bar addend: -50 - + undefined-atoms: - name: bar - + ... # CHECK: name: foo diff --git a/lld/test/core/fixups-dup-named.objtxt b/lld/test/core/fixups-dup-named.objtxt index 38ca56ebca5..1c57cd73bf0 100644 --- a/lld/test/core/fixups-dup-named.objtxt +++ b/lld/test/core/fixups-dup-named.objtxt @@ -16,7 +16,7 @@ defined-atoms: - offset: 6 kind: pcrel32 target: bar_2 - + - name: bar ref-name: bar_1 scope: static @@ -24,7 +24,7 @@ defined-atoms: - name: bar ref-name: bar_2 scope: static - + ... diff --git a/lld/test/core/fixups-named.objtxt b/lld/test/core/fixups-named.objtxt index 7eebb06e372..1427a9b705d 100644 --- a/lld/test/core/fixups-named.objtxt +++ b/lld/test/core/fixups-named.objtxt @@ -8,7 +8,7 @@ defined-atoms: - name: foo type: code - content: [ E8, 00, 00, 00, 00, + content: [ E8, 00, 00, 00, 00, E8, 00, 00, 00, 00 ] references: - offset: 1 @@ -17,14 +17,14 @@ defined-atoms: - offset: 6 kind: pcrel32 target: baz - + - name: baz scope: static type: code undefined-atoms: - name: bar - + ... diff --git a/lld/test/core/fixups-unnamed.objtxt b/lld/test/core/fixups-unnamed.objtxt index 3ca0b30fdcd..88afb6a447a 100644 --- a/lld/test/core/fixups-unnamed.objtxt +++ b/lld/test/core/fixups-unnamed.objtxt @@ -8,7 +8,7 @@ defined-atoms: - name: foo type: code - content: [ 48, 8D, 3D, 00, 00, 00, 00, + content: [ 48, 8D, 3D, 00, 00, 00, 00, 48, 8D, 3D, 00, 00, 00, 00 ] references: - offset: 3 @@ -17,7 +17,7 @@ defined-atoms: - offset: 10 kind: pcrel32 target: LC2 - + - ref-name: LC1 type: c-string @@ -28,7 +28,7 @@ defined-atoms: type: c-string merge: by-content content: [ 74, 68, 65, 72, 65, 00 ] - + ... diff --git a/lld/test/core/ingroup-test-big.objtxt b/lld/test/core/ingroup-test-big.objtxt index d0b2c46d770..f666328bb4c 100644 --- a/lld/test/core/ingroup-test-big.objtxt +++ b/lld/test/core/ingroup-test-big.objtxt @@ -1,16 +1,16 @@ # RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER --- -defined-atoms: +defined-atoms: - name: A scope: global - references: + references: - kind: layout-after offset: 0 target: B - name: B scope: global - references: + references: - kind: in-group offset: 0 target: A @@ -19,13 +19,13 @@ defined-atoms: target: C - name: C scope: global - references: + references: - kind: in-group offset: 0 target: A - name: E scope: global - references: + references: - kind: in-group offset: 0 target: E @@ -34,13 +34,13 @@ defined-atoms: target: F - name: F scope: global - references: + references: - kind: in-group offset: 0 target: E - name: D scope: global - references: + references: - kind: in-group offset: 0 target: A diff --git a/lld/test/core/ingroup-test-loop.objtxt b/lld/test/core/ingroup-test-loop.objtxt index 7bed173f35b..b22dcb8b589 100644 --- a/lld/test/core/ingroup-test-loop.objtxt +++ b/lld/test/core/ingroup-test-loop.objtxt @@ -1,16 +1,16 @@ # RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER --- -defined-atoms: +defined-atoms: - name: A scope: global - references: + references: - kind: layout-after offset: 0 target: E - name: E scope: global - references: + references: - kind: in-group offset: 0 target: A diff --git a/lld/test/core/ingroup-test-with-layout-after.objtxt b/lld/test/core/ingroup-test-with-layout-after.objtxt index 6a8bac28a6c..d93e194446d 100644 --- a/lld/test/core/ingroup-test-with-layout-after.objtxt +++ b/lld/test/core/ingroup-test-with-layout-after.objtxt @@ -1,16 +1,16 @@ # RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER --- -defined-atoms: +defined-atoms: - name: A scope: global - references: + references: - kind: layout-after offset: 0 target: B - name: B scope: global - references: + references: - kind: in-group offset: 0 target: A @@ -19,7 +19,7 @@ defined-atoms: target: E - name: F scope: global - references: + references: - kind: in-group offset: 0 target: E @@ -28,13 +28,13 @@ defined-atoms: target: G - name: G scope: global - references: + references: - kind: in-group offset: 0 target: E - name: E scope: global - references: + references: - kind: in-group offset: 0 target: A diff --git a/lld/test/core/ingroup-test.objtxt b/lld/test/core/ingroup-test.objtxt index 6ebbb815485..b5eeebe73c7 100644 --- a/lld/test/core/ingroup-test.objtxt +++ b/lld/test/core/ingroup-test.objtxt @@ -1,31 +1,31 @@ # RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER --- -defined-atoms: +defined-atoms: - name: A scope: global - name: B scope: global - references: + references: - kind: in-group offset: 0 target: A - name: F scope: global - references: + references: - kind: in-group offset: 0 target: E - name: G scope: global - references: + references: - kind: in-group offset: 0 target: E - name: E scope: global - references: + references: - kind: in-group offset: 0 target: A diff --git a/lld/test/core/layoutafter-test.objtxt b/lld/test/core/layoutafter-test.objtxt index 58c7d0a9674..757e52cd187 100644 --- a/lld/test/core/layoutafter-test.objtxt +++ b/lld/test/core/layoutafter-test.objtxt @@ -1,24 +1,24 @@ # RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER --- -defined-atoms: +defined-atoms: - name: fn3 scope: global - name: fn2 scope: global - references: + references: - kind: layout-after offset: 0 target: fn3 - name: fn scope: global - references: + references: - kind: layout-after offset: 0 target: fn1 - name: fn1 scope: global - references: + references: - kind: layout-after offset: 0 target: fn2 diff --git a/lld/test/core/layoutbefore-test.objtxt b/lld/test/core/layoutbefore-test.objtxt index ed1afe76119..038c14dc0fd 100644 --- a/lld/test/core/layoutbefore-test.objtxt +++ b/lld/test/core/layoutbefore-test.objtxt @@ -1,19 +1,19 @@ # RUN: lld -core --add-pass layout %s | FileCheck %s -check-prefix=CHKORDER --- -defined-atoms: +defined-atoms: - name: fn scope: global - name: fn1 scope: global - references: + references: - kind: layout-before offset: 0 target: fn - name: fn2 scope: global - references: + references: - kind: layout-before offset: 0 target: fn1 diff --git a/lld/test/core/pass-got-basic.objtxt b/lld/test/core/pass-got-basic.objtxt index 6f0d4f2bcec..4b66f703f4f 100644 --- a/lld/test/core/pass-got-basic.objtxt +++ b/lld/test/core/pass-got-basic.objtxt @@ -8,11 +8,11 @@ defined-atoms: - name: foo type: code - content: [ 48, 8B, 0D, 00, 00, 00, 00, - 48, 8B, 0D, 00, 00, 00, 00, - 48, 8B, 0D, 00, 00, 00, 00, + content: [ 48, 8B, 0D, 00, 00, 00, 00, + 48, 8B, 0D, 00, 00, 00, 00, + 48, 8B, 0D, 00, 00, 00, 00, + 48, 83, 3D, 00, 00, 00, 00, 00, 48, 83, 3D, 00, 00, 00, 00, 00, - 48, 83, 3D, 00, 00, 00, 00, 00, 48, 83, 3D, 00, 00, 00, 00, 00, 48, 83, 3D, 00, 00, 00, 00, 00 ] references: @@ -46,12 +46,12 @@ defined-atoms: shared-library-atoms: - name: malloc load-name: libc.so - + ... # CHECK: defined-atoms: # CHECK: name: foo -# CHECK: references: +# CHECK: references: # CHECK: kind: pcrel32 # CHECK: offset: 3 # CHECK: target: L diff --git a/lld/test/core/pass-stubs-basic.objtxt b/lld/test/core/pass-stubs-basic.objtxt index 8203755fc85..bcc1ca333a2 100644 --- a/lld/test/core/pass-stubs-basic.objtxt +++ b/lld/test/core/pass-stubs-basic.objtxt @@ -8,7 +8,7 @@ defined-atoms: - name: foo type: code - content: [ E8, 00, 00, 00, 00, E8, 00, 00, 00, + content: [ E8, 00, 00, 00, 00, E8, 00, 00, 00, 00, 48 ,8B, 05, 00, 00, 00, 00 ] references: - offset: 1 @@ -24,14 +24,14 @@ defined-atoms: shared-library-atoms: - name: malloc load-name: libc.so - + - name: free load-name: libc.so ... # CHECK: name: foo -# CHECK: references: +# CHECK: references: # CHECK: kind: call32 # CHECK: target: L # CHECK: kind: call32 diff --git a/lld/test/core/permissions.objtxt b/lld/test/core/permissions.objtxt index fd07f29a6ff..af33ea65c45 100644 --- a/lld/test/core/permissions.objtxt +++ b/lld/test/core/permissions.objtxt @@ -11,13 +11,13 @@ defined-atoms: - name: two type: data permissions: rw- - + - name: three type: const-data - + - name: four type: unknown - + - name: oddCode type: code permissions: rwx @@ -25,15 +25,15 @@ defined-atoms: - name: oddData type: data permissions: rwx - + - name: oddConstData type: const-data permissions: rw- - + - name: oddUnknown type: unknown permissions: rw- - + ... # CHECK: --- diff --git a/lld/test/core/section-position.objtxt b/lld/test/core/section-position.objtxt index 675c1edc0d5..f34367eb319 100644 --- a/lld/test/core/section-position.objtxt +++ b/lld/test/core/section-position.objtxt @@ -23,7 +23,7 @@ defined-atoms: - name: data_start type: data section-position: start - + --- defined-atoms: - name: data_end_too @@ -33,7 +33,7 @@ defined-atoms: - name: some_more_data type: data content: [ 03, 04 ] - + --- defined-atoms: - name: early_data_too @@ -44,7 +44,7 @@ defined-atoms: ... -# CHKUNORD: defined-atoms: +# CHKUNORD: defined-atoms: # CHKUNORD: - name: data_end # CHKUNORD: section-position: end # CHKUNORD: - name: some_data @@ -63,7 +63,7 @@ defined-atoms: # CHKUNORD: section-position: early # CHKUNORD: ... -# CHKORDER: defined-atoms: +# CHKORDER: defined-atoms: # CHKORDER: - name: data_start # CHKORDER: section-position: start # CHKORDER: - name: early_data diff --git a/lld/test/core/shared-library-basic.objtxt b/lld/test/core/shared-library-basic.objtxt index fb0b65feecb..61445e7431f 100644 --- a/lld/test/core/shared-library-basic.objtxt +++ b/lld/test/core/shared-library-basic.objtxt @@ -10,14 +10,14 @@ shared-library-atoms: load-name: libc.so type: code size: 0 - + - name: free load-name: libc.so - name: fast_malloc load-name: libc.so can-be-null: at-runtime - + - name: stdout load-name: libc.so type: data diff --git a/lld/test/core/shared-library-coalesce.objtxt b/lld/test/core/shared-library-coalesce.objtxt index 5c860ccc043..51ff93e87a8 100644 --- a/lld/test/core/shared-library-coalesce.objtxt +++ b/lld/test/core/shared-library-coalesce.objtxt @@ -8,14 +8,14 @@ shared-library-atoms: - name: foo1 load-name: libc.so - + - name: foo2 load-name: libc.so - name: bar1 load-name: libc.so can-be-null: at-runtime - + - name: bar2 load-name: libc.so can-be-null: at-runtime @@ -23,13 +23,13 @@ shared-library-atoms: - name: mismatchNull1 load-name: libc.so can-be-null: at-runtime - + - name: mismatchNull2 load-name: libc.so - + - name: mismatchload1 load-name: liba.so - + - name: mismatchload2 load-name: libb.so @@ -37,7 +37,7 @@ shared-library-atoms: shared-library-atoms: - name: foo2 load-name: libc.so - + - name: foo3 load-name: libc.so @@ -51,14 +51,14 @@ shared-library-atoms: - name: mismatchNull1 load-name: libc.so - + - name: mismatchNull2 load-name: libc.so can-be-null: at-runtime - + - name: mismatchload1 load-name: libb.so - + - name: mismatchload2 load-name: liba.so diff --git a/lld/test/core/undef-coalesce-error.objtxt b/lld/test/core/undef-coalesce-error.objtxt index adf13a24409..a0485befd28 100644 --- a/lld/test/core/undef-coalesce-error.objtxt +++ b/lld/test/core/undef-coalesce-error.objtxt @@ -3,7 +3,7 @@ # RUN: lld -core %s | FileCheck %s # -# Test that -undefines-are-errors triggers and error +# Test that -undefines-are-errors triggers and error # and that not using that option results in undefined atoms. # @@ -11,7 +11,7 @@ defined-atoms: - name: foo type: code - + undefined-atoms: - name: malloc - name: free @@ -19,7 +19,7 @@ undefined-atoms: defined-atoms: - name: bar type: code - + undefined-atoms: - name: malloc - name: myfunc @@ -28,7 +28,7 @@ defined-atoms: - name: myfunc scope: global type: code - + undefined-atoms: - name: free ... diff --git a/lld/test/core/undef-coalesce.objtxt b/lld/test/core/undef-coalesce.objtxt index 8a9f502ab1a..822ed5acf19 100644 --- a/lld/test/core/undef-coalesce.objtxt +++ b/lld/test/core/undef-coalesce.objtxt @@ -9,7 +9,7 @@ defined-atoms: - name: foo type: code - + undefined-atoms: - name: malloc - name: free @@ -17,7 +17,7 @@ undefined-atoms: defined-atoms: - name: bar type: code - + undefined-atoms: - name: malloc - name: myfunc @@ -26,7 +26,7 @@ defined-atoms: - name: myfunc scope: global type: code - + undefined-atoms: - name: free ... diff --git a/lld/test/darwin/hello-world.objtxt b/lld/test/darwin/hello-world.objtxt index d5e88a28165..29f26b78589 100644 --- a/lld/test/darwin/hello-world.objtxt +++ b/lld/test/darwin/hello-world.objtxt @@ -9,8 +9,8 @@ defined-atoms: - name: _main type: code scope: global - content: [ 55, 48, 89, E5, 48, 8D, 3D, 00, - 00, 00, 00, E8, 00, 00, 00, 00, + content: [ 55, 48, 89, E5, 48, 8D, 3D, 00, + 00, 00, 00, E8, 00, 00, 00, 00, 31, C0, 5D, C3 ] references: - offset: 7 @@ -25,7 +25,7 @@ defined-atoms: merge: by-content content: [ 68, 65, 6C, 6C, 6F, 0A, 00 ] -shared-library-atoms: +shared-library-atoms: - name: _printf load-name: /usr/lib/libSystem.B.dylib diff --git a/lld/test/darwin/native-and-mach-o.objtxt b/lld/test/darwin/native-and-mach-o.objtxt index 3f356f5d859..b94bf85ee30 100644 --- a/lld/test/darwin/native-and-mach-o.objtxt +++ b/lld/test/darwin/native-and-mach-o.objtxt @@ -9,13 +9,13 @@ defined-atoms: - name: _main type: code scope: global - content: [ 55, 48, 89, E5, 30, C0, E8, 00, + content: [ 55, 48, 89, E5, 30, C0, E8, 00, 00, 00, 00, 31, C0, 5D, C3 ] references: - offset: 7 kind: X86_64_RELOC_BRANCH target: _foo - + undefined-atoms: - name: _foo diff --git a/lld/test/elf/Hexagon/Inputs/dynobj.c b/lld/test/elf/Hexagon/Inputs/dynobj.c index fa025ad43c6..f17fdadd694 100644 --- a/lld/test/elf/Hexagon/Inputs/dynobj.c +++ b/lld/test/elf/Hexagon/Inputs/dynobj.c @@ -1,5 +1,5 @@ extern int shankar; -static int a; +static int a; static int b; int c; int fn2() { diff --git a/lld/test/elf/Hexagon/dynlib-gotoff.test b/lld/test/elf/Hexagon/dynlib-gotoff.test index 2c20a3e47e9..33324212968 100644 --- a/lld/test/elf/Hexagon/dynlib-gotoff.test +++ b/lld/test/elf/Hexagon/dynlib-gotoff.test @@ -5,7 +5,7 @@ RUN: FileCheck -check-prefix=CHECKGOTPLT %s < %t - name: __got0 CHECKGOTPLT: type: got -CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, +CHECKGOTPLT: content: [ 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, CHECKGOTPLT: 00, 00, 00, 00 ] CHECKGOTPLT: alignment: 2^3 CHECKGOTPLT: section-name: .got.plt @@ -16,7 +16,7 @@ CHECKGOTPLT: content: [ 00, 00, 00, 00 ] CHECKGOTPLT: alignment: 2^2 CHECKGOTPLT: section-name: .got CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_GLOB_DAT CHECKGOTPLT: offset: 0 CHECKGOTPLT: target: c @@ -26,7 +26,7 @@ CHECKGOTPLT: content: [ 00, 00, 00, 00 ] CHECKGOTPLT: alignment: 2^2 CHECKGOTPLT: section-name: .got CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_GLOB_DAT CHECKGOTPLT: offset: 0 CHECKGOTPLT: target: shankar @@ -36,7 +36,7 @@ CHECKGOTPLT: content: [ 00, 00, 00, 00 ] CHECKGOTPLT: alignment: 2^2 CHECKGOTPLT: section-name: .got.plt CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_JMP_SLOT CHECKGOTPLT: offset: 0 CHECKGOTPLT: target: fn @@ -49,7 +49,7 @@ CHECKGOTPLT: content: [ 00, 00, 00, 00 ] CHECKGOTPLT: alignment: 2^2 CHECKGOTPLT: section-name: .got.plt CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_JMP_SLOT CHECKGOTPLT: offset: 0 CHECKGOTPLT: target: fn1 @@ -62,7 +62,7 @@ CHECKGOTPLT: content: [ 00, 00, 00, 00 ] CHECKGOTPLT: alignment: 2^2 CHECKGOTPLT: section-name: .got.plt CHECKGOTPLT: permissions: rw- -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_JMP_SLOT CHECKGOTPLT: offset: 0 CHECKGOTPLT: target: fn2 @@ -71,12 +71,12 @@ CHECKGOTPLT: offset: 0 target: .PLT0 - name: .PLT0 CHECKGOTPLT: type: stub -CHECKGOTPLT: content: [ 00, 40, 00, 00, 1C, C0, 49, 6A, 0E, 42, 9C, E2, -CHECKGOTPLT: 4F, 40, 9C, 91, 3C, C0, 9C, 91, 0E, 42, 0E, 8C, +CHECKGOTPLT: content: [ 00, 40, 00, 00, 1C, C0, 49, 6A, 0E, 42, 9C, E2, +CHECKGOTPLT: 4F, 40, 9C, 91, 3C, C0, 9C, 91, 0E, 42, 0E, 8C, CHECKGOTPLT: 00, C0, 9C, 52 ] CHECKGOTPLT: alignment: 2^4 CHECKGOTPLT: section-name: .plt -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X CHECKGOTPLT: offset: 0 target: __got0 @@ -86,11 +86,11 @@ CHECKGOTPLT: offset: 4 CHECKGOTPLT: addend: 4 - name: __plt_fn CHECKGOTPLT: type: stub -CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, +CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, CHECKGOTPLT: 00, C0, 9C, 52 ] CHECKGOTPLT: alignment: 2^4 CHECKGOTPLT: section-name: .plt -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X CHECKGOTPLT: offset: 0 target: __got_fn @@ -100,11 +100,11 @@ CHECKGOTPLT: offset: 4 CHECKGOTPLT: addend: 4 - name: __plt_fn1 CHECKGOTPLT: type: stub -CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, +CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, CHECKGOTPLT: 00, C0, 9C, 52 ] CHECKGOTPLT: alignment: 2^4 CHECKGOTPLT: section-name: .plt -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X CHECKGOTPLT: offset: 0 target: __got_fn1 @@ -114,11 +114,11 @@ CHECKGOTPLT: offset: 4 CHECKGOTPLT: addend: 4 - name: __plt_fn2 CHECKGOTPLT: type: stub -CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, +CHECKGOTPLT: content: [ 00, 40, 00, 00, 0E, C0, 49, 6A, 1C, C0, 8E, 91, CHECKGOTPLT: 00, C0, 9C, 52 ] CHECKGOTPLT: alignment: 2^4 CHECKGOTPLT: section-name: .plt -CHECKGOTPLT: references: +CHECKGOTPLT: references: CHECKGOTPLT: - kind: R_HEX_B32_PCREL_X CHECKGOTPLT: offset: 0 target: __got_fn2 diff --git a/lld/test/elf/Hexagon/dynlib.test b/lld/test/elf/Hexagon/dynlib.test index 53d72d51d46..1cf3560c5c5 100644 --- a/lld/test/elf/Hexagon/dynlib.test +++ b/lld/test/elf/Hexagon/dynlib.test @@ -1,4 +1,4 @@ -RUN: lld -flavor gnu -target hexagon %p/Inputs/use-shared.hexagon -shared -o %t1 +RUN: lld -flavor gnu -target hexagon %p/Inputs/use-shared.hexagon -shared -o %t1 RUN: llvm-readobj -dyn-symbols %t1 > %t2 RUN: FileCheck -check-prefix=DYNSYMS %s < %t2 diff --git a/lld/test/elf/Hexagon/hexagon-plt-setup.test b/lld/test/elf/Hexagon/hexagon-plt-setup.test index 537afa4f6a2..bc2723db773 100644 --- a/lld/test/elf/Hexagon/hexagon-plt-setup.test +++ b/lld/test/elf/Hexagon/hexagon-plt-setup.test @@ -1,15 +1,15 @@ RUN: lld -flavor gnu -target hexagon %p/Inputs/use-shared.hexagon \ -RUN: --output-filetype=yaml --noinhibit-exec -o %t2 +RUN: --output-filetype=yaml --noinhibit-exec -o %t2 RUN: FileCheck %s < %t2 CHECK: - name: fn3 -CHECK: references: +CHECK: references: CHECK: - kind: R_HEX_B22_PCREL CHECK: offset: 4 - target: + target: CHECK: - kind: R_HEX_B22_PCREL CHECK: offset: 8 - target: + target: CHECK: - kind: layout-before CHECK: offset: 0 CHECK: target: fn1 diff --git a/lld/test/elf/Hexagon/initfini-option.test b/lld/test/elf/Hexagon/initfini-option.test index 5c3395162a6..c9eeb574312 100644 --- a/lld/test/elf/Hexagon/initfini-option.test +++ b/lld/test/elf/Hexagon/initfini-option.test @@ -1,7 +1,7 @@ # This tests the functionality that lld is able to create # init_array/fini_array sections in the output ELF. This # corresponds to the the .init_array/.fini_array sections -# in the output ELF. +# in the output ELF. RUN: lld -flavor gnu -target hexagon %p/Inputs/initfini-option.o \ RUN: -init init -fini fini --noinhibit-exec --output-filetype=yaml -static -o %t @@ -9,13 +9,13 @@ RUN: FileCheck %s < %t CHECK: content: [ 00, 00, 00, 00 ] CHECK: section-name: .init_array -CHECK: references: +CHECK: references: CHECK: - kind: R_HEX_32 CHECK: offset: 0 CHECK: target: init CHECK: content: [ 00, 00, 00, 00 ] CHECK: section-name: .fini_array -CHECK: references: +CHECK: references: CHECK: - kind: R_HEX_32 CHECK: offset: 0 CHECK: target: fini diff --git a/lld/test/elf/Hexagon/rela-order.test b/lld/test/elf/Hexagon/rela-order.test index 2f3814add0c..925a82c2929 100644 --- a/lld/test/elf/Hexagon/rela-order.test +++ b/lld/test/elf/Hexagon/rela-order.test @@ -1,5 +1,5 @@ RUN: lld -flavor gnu -target hexagon %p/Inputs/dynobj.o -shared \ -RUN: --noinhibit-exec -o %t +RUN: --noinhibit-exec -o %t RUN: llvm-objdump -section-headers %t | FileCheck %s CHECK: .dynsym diff --git a/lld/test/elf/Mips/dynlib-dynamic.test b/lld/test/elf/Mips/dynlib-dynamic.test index 9d27400f8eb..3f52e072deb 100644 --- a/lld/test/elf/Mips/dynlib-dynamic.test +++ b/lld/test/elf/Mips/dynlib-dynamic.test @@ -8,7 +8,7 @@ # CHECK: Format: ELF32-mips # CHECK: Arch: mipsel # CHECK: AddressSize: 32bit -# CHECK: LoadName: +# CHECK: LoadName: # CHECK: DynamicSection [ (15 entries) # CHECK: Tag Type Name/Value # CHECK: 0x00000004 HASH 0xD4 diff --git a/lld/test/elf/Mips/dynlib-dynsym.test b/lld/test/elf/Mips/dynlib-dynsym.test index 8f750e68f6d..cd36471c071 100644 --- a/lld/test/elf/Mips/dynlib-dynsym.test +++ b/lld/test/elf/Mips/dynlib-dynsym.test @@ -14,7 +14,7 @@ # CHECK-DYN: Format: ELF32-mips # CHECK-DYN: Arch: mipsel # CHECK-DYN: AddressSize: 32bit -# CHECK-DYN: LoadName: +# CHECK-DYN: LoadName: # CHECK-DYN: DynamicSymbols [ # CHECK-DYN: Symbol { # CHECK-DYN: Name: @ (0) diff --git a/lld/test/elf/Mips/dynlib-fileheader.test b/lld/test/elf/Mips/dynlib-fileheader.test index 088cf71f4f3..b531457c44f 100644 --- a/lld/test/elf/Mips/dynlib-fileheader.test +++ b/lld/test/elf/Mips/dynlib-fileheader.test @@ -8,7 +8,7 @@ # CHECK: Format: ELF32-mips # CHECK: Arch: mipsel # CHECK: AddressSize: 32bit -# CHECK: LoadName: +# CHECK: LoadName: # CHECK: ElfHeader { # CHECK: Ident { # CHECK: Magic: (7F 45 4C 46) diff --git a/lld/test/elf/Mips/got16.test b/lld/test/elf/Mips/got16.test index ddc9c8eae1c..e872e70858a 100644 --- a/lld/test/elf/Mips/got16.test +++ b/lld/test/elf/Mips/got16.test @@ -94,7 +94,7 @@ # RAW: 178: 24 80 84 8f lw $4, -32732($gp) # RAW: SYMBOL TABLE: -# RAW: 00000000 *UND* 00000000 +# RAW: 00000000 *UND* 00000000 # RAW: 00002000 l .data 00000000 local .global glob diff --git a/lld/test/elf/Mips/gotsym.test b/lld/test/elf/Mips/gotsym.test index 9e7a41133d7..8a6a3e2e5ab 100644 --- a/lld/test/elf/Mips/gotsym.test +++ b/lld/test/elf/Mips/gotsym.test @@ -6,7 +6,7 @@ # SHARED: Sections: # SHARED: Idx Name Size Address Type -# SHARED: 6 .got 00000008 0000000000001000 DATA +# SHARED: 6 .got 00000008 0000000000001000 DATA # SHARED: SYMBOL TABLE: # SHARED: 00001000 g *ABS* 00000000 _GLOBAL_OFFSET_TABLE_ # SHARED: 00008ff0 g *ABS* 00000000 _gp diff --git a/lld/test/elf/Mips/hilo16-1.test b/lld/test/elf/Mips/hilo16-1.test index 87484927181..87efa517527 100644 --- a/lld/test/elf/Mips/hilo16-1.test +++ b/lld/test/elf/Mips/hilo16-1.test @@ -14,8 +14,8 @@ # CHECK: Sections: # CHECK: Idx Name Size Address Type -# CHECK: 4 .text 00000018 0000000000000134 TEXT DATA -# CHECK: 6 .got 00000008 0000000000001000 DATA +# CHECK: 4 .text 00000018 0000000000000134 TEXT DATA +# CHECK: 6 .got 00000008 0000000000001000 DATA # CHECK: SYMBOL TABLE: # CHECK: 00000134 g F .text 0000000c glob1 diff --git a/lld/test/elf/X86_64/dontignorezerosize-sections.test b/lld/test/elf/X86_64/dontignorezerosize-sections.test index 7123661a445..101e6cb55b2 100644 --- a/lld/test/elf/X86_64/dontignorezerosize-sections.test +++ b/lld/test/elf/X86_64/dontignorezerosize-sections.test @@ -3,7 +3,7 @@ RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/zerosizedsection.o \ RUN: --noinhibit-exec --output-filetype=yaml -o %t RUN: FileCheck %s < %t -CHECK: references: +CHECK: references: CHECK: - kind: R_X86_64_16 CHECK: offset: 0 CHECK: target: L000 diff --git a/lld/test/elf/X86_64/extern-tls.test b/lld/test/elf/X86_64/extern-tls.test index d0ed9ef2452..c8e7580e5f3 100644 --- a/lld/test/elf/X86_64/extern-tls.test +++ b/lld/test/elf/X86_64/extern-tls.test @@ -10,7 +10,7 @@ CHECKGOT: alignment: 2^3 CHECKGOT: section-choice: custom-required CHECKGOT: section-name: .got CHECKGOT: permissions: rw- -CHECKGOT: references: +CHECKGOT: references: CHECKGOT: - kind: R_X86_64_TPOFF64 CHECKGOT: offset: 0 CHECKGOT: target: extern_tls diff --git a/lld/test/elf/X86_64/initfini-option.test b/lld/test/elf/X86_64/initfini-option.test index 7a535d3f8b3..a86f370889f 100644 --- a/lld/test/elf/X86_64/initfini-option.test +++ b/lld/test/elf/X86_64/initfini-option.test @@ -1,7 +1,7 @@ # This tests the functionality that lld is able to create # init_array/fini_array sections in the output ELF. This # corresponds to the the .init_array/.fini_array sections -# in the output ELF. +# in the output ELF. RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/initfini-option.o \ RUN: -init init -fini fini --noinhibit-exec --output-filetype=yaml -o %t @@ -9,13 +9,13 @@ RUN: FileCheck %s < %t CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] CHECK: section-name: .init_array -CHECK: references: +CHECK: references: CHECK: - kind: R_X86_64_64 CHECK: offset: 0 CHECK: target: init CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] CHECK: section-name: .fini_array -CHECK: references: +CHECK: references: CHECK: - kind: R_X86_64_64 CHECK: offset: 0 CHECK: target: fini diff --git a/lld/test/elf/X86_64/initfini.test b/lld/test/elf/X86_64/initfini.test index 642ee22293b..d882352a1c3 100644 --- a/lld/test/elf/X86_64/initfini.test +++ b/lld/test/elf/X86_64/initfini.test @@ -1,7 +1,7 @@ # This tests the functionality that lld is able to read # init_array/fini_array sections in the input ELF. This # corresponds to the the .init_array/.fini_array sections -# in the output ELF. +# in the output ELF. RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/initfini.o \ RUN: --noinhibit-exec --output-filetype=yaml -o %t @@ -10,14 +10,14 @@ RUN: FileCheck %s < %t CHECK: - type: data CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] CHECK: section-name: .init_array -CHECK: references: +CHECK: references: CHECK: - kind: R_X86_64_64 CHECK: offset: 0 CHECK: target: constructor CHECK: - type: data CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] CHECK: section-name: .fini_array -CHECK: references: +CHECK: references: CHECK: - kind: R_X86_64_64 CHECK: offset: 0 CHECK: target: destructor diff --git a/lld/test/elf/X86_64/layoutpass-order.test b/lld/test/elf/X86_64/layoutpass-order.test index b5123eb2612..e4ebef1d52d 100644 --- a/lld/test/elf/X86_64/layoutpass-order.test +++ b/lld/test/elf/X86_64/layoutpass-order.test @@ -1,5 +1,5 @@ # This test checks that we follow the command line order of layouting -# symbols in the output file +# symbols in the output file RUN: lld -flavor gnu -target x86_64 %p/Inputs/layoutpass/1.o \ RUN: %p/Inputs/layoutpass/lib2.a %p/Inputs/layoutpass/3.o -o %t \ diff --git a/lld/test/elf/X86_64/multi-weak-layout.test b/lld/test/elf/X86_64/multi-weak-layout.test index 6e158654316..37a051cf6d3 100644 --- a/lld/test/elf/X86_64/multi-weak-layout.test +++ b/lld/test/elf/X86_64/multi-weak-layout.test @@ -7,21 +7,21 @@ RUN: FileCheck %s -check-prefix=WEAKSYMS < %t WEAKSYMS: - ref-name: [[SYMA:[-a-zA-Z0-9_]+]] WEAKSYMS: type: data -WEAKSYMS: references: +WEAKSYMS: references: WEAKSYMS: - kind: layout-after WEAKSYMS: target: [[SYMB:[-a-zA-Z0-9_]+]] WEAKSYMS: - name: myfn2 WEAKSYMS: scope: global WEAKSYMS: type: data WEAKSYMS: merge: as-weak -WEAKSYMS: references: +WEAKSYMS: references: WEAKSYMS: - kind: layout-after WEAKSYMS: target: [[SYMB]] WEAKSYMS: - ref-name: [[SYMB]] WEAKSYMS: scope: global WEAKSYMS: type: data WEAKSYMS: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -WEAKSYMS: references: +WEAKSYMS: references: WEAKSYMS: - kind: R_X86_64_64 WEAKSYMS: target: test WEAKSYMS: - kind: layout-before @@ -32,14 +32,14 @@ WEAKSYMS: - name: myfn1 WEAKSYMS: scope: global WEAKSYMS: type: data WEAKSYMS: merge: as-weak -WEAKSYMS: references: +WEAKSYMS: references: WEAKSYMS: - kind: layout-after WEAKSYMS: target: [[SYMC]] WEAKSYMS: - ref-name: [[SYMC]] WEAKSYMS: scope: global WEAKSYMS: type: data WEAKSYMS: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] -WEAKSYMS: references: +WEAKSYMS: references: WEAKSYMS: - kind: R_X86_64_64 WEAKSYMS: target: test WEAKSYMS: - kind: layout-before diff --git a/lld/test/elf/X86_64/rodata.test b/lld/test/elf/X86_64/rodata.test index 787cd7047ce..61af99f65cf 100644 --- a/lld/test/elf/X86_64/rodata.test +++ b/lld/test/elf/X86_64/rodata.test @@ -1,9 +1,9 @@ -# This tests that the ordinals for all merge atoms and defined atoms have been +# This tests that the ordinals for all merge atoms and defined atoms have been # set properly RUN: lld -flavor gnu -target x86_64 %p/Inputs/rodata.o --noinhibit-exec \ RUN: --merge-strings -static -o %t1 -RUN: llvm-nm -n %t1 | FileCheck %s +RUN: llvm-nm -n %t1 | FileCheck %s CHECK: {{[0-9a-f]+}} R _nl_default_default_domain CHECK: {{[0-9a-f]+}} R _nl_default_default_dirname diff --git a/lld/test/elf/X86_64/sectionmap.test b/lld/test/elf/X86_64/sectionmap.test index ed681899b9e..a38f23e32b9 100644 --- a/lld/test/elf/X86_64/sectionmap.test +++ b/lld/test/elf/X86_64/sectionmap.test @@ -1,5 +1,5 @@ # This tests that we are able to merge the section .gcc_except_table, -# .data.rel.local, .data.rel.ro, any other sections that belong to .data +# .data.rel.local, .data.rel.ro, any other sections that belong to .data # into appropriate output sections RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/sectionmap.o \ RUN: --noinhibit-exec -o %t diff --git a/lld/test/elf/X86_64/startGroupEndGroupWithDynlib.test b/lld/test/elf/X86_64/startGroupEndGroupWithDynlib.test index 9707d5d80bf..3e40997db38 100644 --- a/lld/test/elf/X86_64/startGroupEndGroupWithDynlib.test +++ b/lld/test/elf/X86_64/startGroupEndGroupWithDynlib.test @@ -1,4 +1,4 @@ -# This tests functionality of --start-group, --end-group with a dynamic library +# This tests functionality of --start-group, --end-group with a dynamic library # Mix dynamic libraries/object files in group RUN: lld -flavor gnu -target x86_64 %p/Inputs/group/1.o --start-group \ diff --git a/lld/test/elf/X86_64/weak-override.test b/lld/test/elf/X86_64/weak-override.test index da64edf8a04..9f5225b9ece 100644 --- a/lld/test/elf/X86_64/weak-override.test +++ b/lld/test/elf/X86_64/weak-override.test @@ -8,20 +8,20 @@ RUN: FileCheck -check-prefix=WEAKATOMSORDER %s < %t2 WEAKORDER: {{[0-9a-c]+}} T f -WEAKATOMSORDER: references: +WEAKATOMSORDER: references: WEAKATOMSORDER: - kind: layout-after WEAKATOMSORDER: offset: 0 WEAKATOMSORDER: target: fn WEAKATOMSORDER: - name: fn -WEAKATOMSORDER: references: +WEAKATOMSORDER: references: WEAKATOMSORDER: - kind: layout-after WEAKATOMSORDER: offset: 0 WEAKATOMSORDER: target: [[CONSTSTRA:[-a-zA-Z0-9_]+]] WEAKATOMSORDER: - ref-name: [[CONSTSTRA]] WEAKATOMSORDER: scope: global -WEAKATOMSORDER: content: [ 55, 48, 89, E5, BF, 00, 00, 00, 00, E8, 00, 00, +WEAKATOMSORDER: content: [ 55, 48, 89, E5, BF, 00, 00, 00, 00, E8, 00, 00, WEAKATOMSORDER: 00, 00, 5D, C3 ] -WEAKATOMSORDER: references: +WEAKATOMSORDER: references: WEAKATOMSORDER: - kind: layout-before WEAKATOMSORDER: offset: 0 WEAKATOMSORDER: target: fn @@ -30,9 +30,9 @@ WEAKATOMSORDER: offset: 0 WEAKATOMSORDER: target: main WEAKATOMSORDER: - name: main WEAKATOMSORDER: scope: global -WEAKATOMSORDER: content: [ 55, 48, 89, E5, B8, 00, 00, 00, 00, E8, 00, 00, +WEAKATOMSORDER: content: [ 55, 48, 89, E5, B8, 00, 00, 00, 00, E8, 00, 00, WEAKATOMSORDER: 00, 00, B8, 00, 00, 00, 00, 5D, C3 ] -WEAKATOMSORDER: references: +WEAKATOMSORDER: references: WEAKATOMSORDER: - kind: R_X86_64_PC32 WEAKATOMSORDER: offset: 10 WEAKATOMSORDER: target: f @@ -41,14 +41,14 @@ WEAKATOMSORDER: - kind: layout-before WEAKATOMSORDER: offset: 0 WEAKATOMSORDER: target: [[CONSTSTRA]] WEAKATOMSORDER: - ref-name: {{[0-9A-Z]+}} -WEAKATOMSORDER: references: +WEAKATOMSORDER: references: WEAKATOMSORDER: - kind: layout-after WEAKATOMSORDER: offset: 0 WEAKATOMSORDER: target: f WEAKATOMSORDER: - name: f WEAKATOMSORDER: scope: global -WEAKATOMSORDER: content: [ 55, 48, 89, E5, BF, 00, 00, 00, 00, E8, 00, 00, +WEAKATOMSORDER: content: [ 55, 48, 89, E5, BF, 00, 00, 00, 00, E8, 00, 00, WEAKATOMSORDER: 00, 00, 5D, C3 ] -WEAKATOMSORDER: references: +WEAKATOMSORDER: references: WEAKATOMSORDER: - kind: layout-before WEAKATOMSORDER: offset: 0 diff --git a/lld/test/elf/X86_64/weak-zero-sized.test b/lld/test/elf/X86_64/weak-zero-sized.test index 496b01717e1..360a5878daf 100644 --- a/lld/test/elf/X86_64/weak-zero-sized.test +++ b/lld/test/elf/X86_64/weak-zero-sized.test @@ -17,7 +17,7 @@ WEAKATOMSORDER: - name: _start WEAKATOMSORDER: scope: global WEAKATOMSORDER: merge: as-weak WEAKATOMSORDER: alignment: 2^2 -WEAKATOMSORDER: references: +WEAKATOMSORDER: references: WEAKATOMSORDER: - kind: layout-after WEAKATOMSORDER: offset: 0 WEAKATOMSORDER: target: [[TARGETB]] @@ -25,7 +25,7 @@ WEAKATOMSORDER: - ref-name: [[TARGETB]] WEAKATOMSORDER: scope: global WEAKATOMSORDER: content: [ C3 ] WEAKATOMSORDER: alignment: 2^2 -WEAKATOMSORDER: references: +WEAKATOMSORDER: references: WEAKATOMSORDER: - kind: layout-before WEAKATOMSORDER: offset: 0 WEAKATOMSORDER: target: [[TARGETA]] diff --git a/lld/test/elf/abs.test b/lld/test/elf/abs.test index 317f87503ec..a48d6db62c0 100644 --- a/lld/test/elf/abs.test +++ b/lld/test/elf/abs.test @@ -11,7 +11,7 @@ # RUN: lld -flavor gnu --output-filetype=yaml -r %p/Inputs/abs-test.i386 | FileCheck -check-prefix=YAML %s -YAML: absolute-atoms: +YAML: absolute-atoms: YAML: - name: absLocalSymbol YAML: value: {{0x[0]+C0000}} YAML: - name: absGlobalSymbol diff --git a/lld/test/elf/archive-elf-forceload.test b/lld/test/elf/archive-elf-forceload.test index a06ef939aaa..a0d11509481 100644 --- a/lld/test/elf/archive-elf-forceload.test +++ b/lld/test/elf/archive-elf-forceload.test @@ -1,5 +1,5 @@ -# Tests the functionality of archive libraries reading -# and resolution +# Tests the functionality of archive libraries reading +# and resolution # Note: The binary files would not be required once we have support to generate # binary archives from textual(yaml) input # @@ -10,13 +10,13 @@ # fn(); # return 0; # } -# +# # archive file # int fn() # { # return 0; # } -# +# # int fn1() # { # return 0; @@ -27,14 +27,14 @@ RUN: lld -flavor gnu -target x86_64-linux -e main %p/Inputs/mainobj.x86_64 \ RUN: --whole-archive %p/Inputs/libfnarchive.a --no-whole-archive --output-filetype=yaml \ RUN: | FileCheck -check-prefix FORCELOAD %s -FORCELOAD: defined-atoms: +FORCELOAD: defined-atoms: FORCELOAD: - name: fn1 FORCELOAD: scope: global FORCELOAD: content: [ 55, 48, 89, E5, B8, 00, 00, 00, 00, 5D, C3 ] FORCELOAD: - name: fn FORCELOAD: scope: global FORCELOAD: content: [ 55, 48, 89, E5, B8, 00, 00, 00, 00, 5D, C3 ] -FORCELOAD: absolute-atoms: +FORCELOAD: absolute-atoms: FORCELOAD: - name: main.c FORCELOAD: value: 0x0 FORCELOAD: - name: fn1.c diff --git a/lld/test/elf/branch.test b/lld/test/elf/branch.test index 961efd71658..5e0b4a5aabf 100644 --- a/lld/test/elf/branch.test +++ b/lld/test/elf/branch.test @@ -6,10 +6,10 @@ RUN: llvm-readobj -h %t1 | FileCheck -check-prefix=hexagon-readobj %s hexagon-yaml: - name: back hexagon-yaml: scope: global -hexagon-yaml: content: [ 00, C0, 00, 7F, 00, C0, 00, 5A, 00, 00, 00, 00, +hexagon-yaml: content: [ 00, C0, 00, 7F, 00, C0, 00, 5A, 00, 00, 00, 00, hexagon-yaml: 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 ] hexagon-yaml: references: -hexagon-yaml: - kind: +hexagon-yaml: - kind: hexagon-yaml: offset: 4 hexagon-yaml: target: target @@ -17,7 +17,7 @@ hexagon-yaml: - name: target hexagon-yaml: scope: global hexagon-yaml: content: [ 00, C0, 00, 5A ] hexagon-yaml: references: -hexagon-yaml: - kind: +hexagon-yaml: - kind: hexagon-yaml: offset: 0 hexagon-yaml: target: back diff --git a/lld/test/elf/check.test b/lld/test/elf/check.test index dfed51e2d5a..50df23fd778 100644 --- a/lld/test/elf/check.test +++ b/lld/test/elf/check.test @@ -1,13 +1,13 @@ -# This tests the basic functionality of ordering data and functions as they +# This tests the basic functionality of ordering data and functions as they # appear in the inputs RUN: lld -flavor gnu -target i386 -e global_func --noinhibit-exec --output-filetype=yaml \ -RUN: %p/Inputs/object-test.elf-i386 -o %t +RUN: %p/Inputs/object-test.elf-i386 -o %t RUN: FileCheck %s -check-prefix ELF-i386 < %t RUN: lld -flavor gnu -target hexagon -e global_func --noinhibit-exec --output-filetype=yaml \ -RUN: %p/Inputs/object-test.elf-hexagon -o %t1 +RUN: %p/Inputs/object-test.elf-hexagon -o %t1 RUN: FileCheck %s -check-prefix ELF-hexagon < %t1 -ELF-i386: defined-atoms: +ELF-i386: defined-atoms: ELF-i386: - name: global_variable ELF-i386: - name: uninitialized_static_variable ELF-i386: - name: global_func @@ -17,9 +17,9 @@ ELF-i386: - name: hidden_func ELF-i386: - name: no_dead_strip ELF-i386: - name: no_special_section_func ELF-i386: - name: special_section_func -ELF-i386: undefined-atoms: +ELF-i386: undefined-atoms: ELF-i386: - name: puts -ELF-i386: absolute-atoms: +ELF-i386: absolute-atoms: ELF-i386: - name: sample.c ELF-hexagon: - name: global_variable @@ -31,9 +31,9 @@ ELF-hexagon: - name: hidden_func ELF-hexagon: - name: no_dead_strip ELF-hexagon: - name: no_special_section_func ELF-hexagon: - name: special_section_func -ELF-hexagon: undefined-atoms: +ELF-hexagon: undefined-atoms: ELF-hexagon: - name: puts -ELF-hexagon: absolute-atoms: +ELF-hexagon: absolute-atoms: ELF-hexagon: - name: sample.c ELF-hexagon: scope: static ELF-hexagon: value: 0x0000000000000000 diff --git a/lld/test/elf/dynamic-undef.test b/lld/test/elf/dynamic-undef.test index afbb0015cfc..01da7e93f12 100644 --- a/lld/test/elf/dynamic-undef.test +++ b/lld/test/elf/dynamic-undef.test @@ -1,5 +1,5 @@ # -# This test creates a executable and tests the options that are used to +# This test creates a executable and tests the options that are used to # to create an executable and a shared library # # This test will fail because there are unresolved symbols from the shared @@ -10,14 +10,14 @@ RUN: FileCheck -check-prefix=EXEC %s < %t1 # This test will pass because of --allow-shlib-undefined RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ RUN: %p/Inputs/shared.so-x86-64 -o %t -e main --allow-shlib-undefined -# Test creation of shared library, this should pass because we are using +# Test creation of shared library, this should pass because we are using # shared option and by default, dynamic library wouldnot create undefined atoms # from the input shared library RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ RUN: %p/Inputs/shared.so-x86-64 -o %t -e main -shared -# Test creation of shared library, this should fail because we are using +# Test creation of shared library, this should fail because we are using # shared option setting the options to use the shared library undefines to -# create undefined atoms from the input shared library +# create undefined atoms from the input shared library RUN: not lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 \ RUN: %p/Inputs/shared.so-x86-64 -o %t -e main -shared \ RUN: --use-shlib-undefines --no-allow-shlib-undefined 2> %t2 diff --git a/lld/test/elf/entry.objtxt b/lld/test/elf/entry.objtxt index 2172cc1cd94..34fcea9c490 100644 --- a/lld/test/elf/entry.objtxt +++ b/lld/test/elf/entry.objtxt @@ -10,21 +10,21 @@ # RUN: lld -flavor gnu -target x86_64 %s -e _entrypoint --noinhibit-exec -o %t1 # RUN: llvm-nm -n %t1 | FileCheck %s -# +# # CHECK: 004001e0 T main # CHECK: 00401080 D _DYNAMIC # CHECK: 00401080 A _end # CHECK: 00401080 A end # CHECK: U _entrypoint -defined-atoms: +defined-atoms: - name: .text alignment: 2^4 section-choice: custom-required section-name: .text - name: main scope: global - content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, + content: [ B8, 00, 00, 00, 00, C7, 44, 24, FC, 00, 00, 00, 00, C3 ] alignment: 2^4 section-choice: custom-required @@ -44,15 +44,15 @@ defined-atoms: section-name: .note.GNU-stack permissions: r-- - name: .eh_frame - content: [ 14, 00, 00, 00, 00, 00, 00, 00, 01, 7A, 52, 00, - 01, 78, 10, 01, 1B, 0C, 07, 08, 90, 01, 00, 00, - 14, 00, 00, 00, 1C, 00, 00, 00, 00, 00, 00, 00, + content: [ 14, 00, 00, 00, 00, 00, 00, 00, 01, 7A, 52, 00, + 01, 78, 10, 01, 1B, 0C, 07, 08, 90, 01, 00, 00, + 14, 00, 00, 00, 1C, 00, 00, 00, 00, 00, 00, 00, 0E, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 ] alignment: 2^3 section-choice: custom-required section-name: .eh_frame permissions: r-- - references: + references: - kind: R_X86_64_PC32 offset: 32 target: .text diff --git a/lld/test/elf/gotpcrel.test b/lld/test/elf/gotpcrel.test index aa682c32705..ae9cb7ec5ef 100644 --- a/lld/test/elf/gotpcrel.test +++ b/lld/test/elf/gotpcrel.test @@ -12,7 +12,7 @@ YAML: kind: R_X86_64_64 YAML: target: main YAML: name: main -YAML: references: +YAML: references: YAML: kind: R_X86_64_GOTPCREL YAML: offset: 3 YAML: target: [[NULLGOT]] diff --git a/lld/test/elf/hexagon-quickdata-sort.test b/lld/test/elf/hexagon-quickdata-sort.test index 129c0b27956..9880bedab0f 100644 --- a/lld/test/elf/hexagon-quickdata-sort.test +++ b/lld/test/elf/hexagon-quickdata-sort.test @@ -1,5 +1,5 @@ RUN: lld -flavor gnu -target hexagon %p/Inputs/quickdata-sort-test.o.elf-hexagon -o %t1 --noinhibit-exec -RUN: llvm-nm -n %t1 | FileCheck %s -check-prefix=quickdataSort +RUN: llvm-nm -n %t1 | FileCheck %s -check-prefix=quickdataSort quickdataSort: 00002000 D AA1 quickdataSort: 00002001 D A1 diff --git a/lld/test/elf/hexagon-quickdata-sortcommon.test b/lld/test/elf/hexagon-quickdata-sortcommon.test index 6495e135a69..455ba2cfb4b 100644 --- a/lld/test/elf/hexagon-quickdata-sortcommon.test +++ b/lld/test/elf/hexagon-quickdata-sortcommon.test @@ -1,5 +1,5 @@ RUN: lld -flavor gnu -target hexagon -o %t1 --noinhibit-exec \ -RUN: %p/Inputs/quickdata-sortcommon-test.o.elf-hexagon +RUN: %p/Inputs/quickdata-sortcommon-test.o.elf-hexagon RUN: llvm-nm -n %t1 | FileCheck %s -check-prefix=quickdataSortCommon quickdataSortCommon: 00002000 D AA1 diff --git a/lld/test/elf/ifunc.test b/lld/test/elf/ifunc.test index 280388cb5b3..18ecd94828d 100644 --- a/lld/test/elf/ifunc.test +++ b/lld/test/elf/ifunc.test @@ -1,5 +1,5 @@ -# This test checks that IRELATIVE relocations are created for symbols that -# need relocation even for static links. +# This test checks that IRELATIVE relocations are created for symbols that +# need relocation even for static links. RUN: lld -flavor gnu -target x86_64-linux --output-filetype=yaml -r \ RUN: %p/Inputs/ifunc.x86-64 | FileCheck %s @@ -42,7 +42,7 @@ PLT: target: [[PLTNAME]] // Make sure the target of main's relocation is a stub with a PC32 relocation. // This relocation is to the got atom, but you can't really write that check in // FileCheck. -PLT: name: +PLT: name: PLT: type: stub PLT: references PLT: kind: R_X86_64_PC32 diff --git a/lld/test/elf/mergeconstants.test b/lld/test/elf/mergeconstants.test index a8f3ef5d1bf..91bc5daa80f 100644 --- a/lld/test/elf/mergeconstants.test +++ b/lld/test/elf/mergeconstants.test @@ -14,7 +14,7 @@ mergeAtoms: scope: global mergeAtoms: type: data mergeAtoms: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] mergeAtoms: alignment: 2^3 -mergeAtoms: references: +mergeAtoms: references: mergeAtoms: - kind: R_X86_64_64 mergeAtoms: offset: 3 mergeAtoms: target: [[CONSTANT]] diff --git a/lld/test/elf/options/dynamic-linker.test b/lld/test/elf/options/dynamic-linker.test index fbd2261c110..3d8feeb6e30 100644 --- a/lld/test/elf/options/dynamic-linker.test +++ b/lld/test/elf/options/dynamic-linker.test @@ -1,5 +1,5 @@ # This tests the functionality of specifying dynamic-linker argument in the -# command line +# command line RUN: lld -flavor gnu -target x86_64 --dynamic-linker="/xyz.so" \ RUN: %p/../Inputs/foo.o.x86-64 --noinhibit-exec -o %t RUN: llvm-objdump -s %t | FileCheck -check-prefix=DYNAMICINTERP1 %s diff --git a/lld/test/elf/reloc.test b/lld/test/elf/reloc.test index ed6a2d0d925..e20aa4090f7 100644 --- a/lld/test/elf/reloc.test +++ b/lld/test/elf/reloc.test @@ -1,7 +1,7 @@ RUN: lld -flavor gnu -target i386 --merge-strings -r --output-filetype=yaml \ RUN: %p/Inputs/reloc-test.elf-i386 | FileCheck %s -check-prefix ELF-i386 -ELF-i386: defined-atoms: +ELF-i386: defined-atoms: ELF-i386: - ref-name: [[STRNAMEA:[-a-zA-Z0-9_]+]] ELF-i386: type: constant ELF-i386: content: [ 68, 65, 6C, 6C, 6F, 20, 77, 6F, 72, 6C, 64, 00 ] @@ -10,19 +10,19 @@ ELF-i386: - ref-name: [[STRNAMEB:[-a-zA-Z0-9_]+]] ELF-i386: alignment: 2^4 ELF-i386: section-choice: custom-required ELF-i386: section-name: .text.startup -ELF-i386: references: +ELF-i386: references: ELF-i386: - kind: layout-after ELF-i386: offset: 0 ELF-i386: target: main ELF-i386: - name: main ELF-i386: scope: global -ELF-i386: content: [ 55, 89, E5, 83, E4, F0, 83, EC, 10, C7, 04, 24, -ELF-i386: 00, 00, 00, 00, E8, FC, FF, FF, FF, 31, C0, C9, +ELF-i386: content: [ 55, 89, E5, 83, E4, F0, 83, EC, 10, C7, 04, 24, +ELF-i386: 00, 00, 00, 00, E8, FC, FF, FF, FF, 31, C0, C9, ELF-i386: C3 ] ELF-i386: alignment: 2^4 ELF-i386: section-choice: custom-required ELF-i386: section-name: .text.startup -ELF-i386: references: +ELF-i386: references: ELF-i386: - kind: R_386_32 ELF-i386: offset: 12 ELF-i386: target: [[STRNAMEA]] @@ -33,9 +33,9 @@ ELF-i386: addend: 252 ELF-i386: - kind: layout-before ELF-i386: offset: 0 ELF-i386: target: [[STRNAMEB]] -ELF-i386: undefined-atoms: +ELF-i386: undefined-atoms: ELF-i386: - name: puts -ELF-i386: absolute-atoms: +ELF-i386: absolute-atoms: ELF-i386: - name: test.c ELF-i386: scope: static ELF-i386: value: 0x0000000000000000 diff --git a/lld/test/elf/symbols.test b/lld/test/elf/symbols.test index 15d014232b1..6b2e506b760 100644 --- a/lld/test/elf/symbols.test +++ b/lld/test/elf/symbols.test @@ -1,5 +1,5 @@ -# Tests the functionality of archive libraries reading -# and resolution +# Tests the functionality of archive libraries reading +# and resolution # Note: The binary files would not be required once we have support to generate # binary archives from textual(yaml) input # @@ -8,8 +8,8 @@ # #extern int __bss_start __attribute__ ((weak)); #int a; -#int main() -#{ +#int main() +#{ # return 0; #} # diff --git a/lld/test/elf/tls.test b/lld/test/elf/tls.test index c05fbf6053d..0eb6393fe9d 100644 --- a/lld/test/elf/tls.test +++ b/lld/test/elf/tls.test @@ -8,12 +8,12 @@ RUN: --noinhibit-exec -e main -static && llvm-objdump -d %t | FileCheck %s // Verify that the TLS accesses have the correct offsets. YAML: type: got -YAML: references: +YAML: references: YAML: kind: R_X86_64_TPOFF64 YAML: target: tls2 YAML: name: main -YAML: references: +YAML: references: YAML: kind: R_X86_64_TPOFF32 YAML: offset: 9 YAML: target: tls1 diff --git a/lld/test/elf/tlsAddr.test b/lld/test/elf/tlsAddr.test index e8c97357b61..6bc5e3e9bf7 100644 --- a/lld/test/elf/tlsAddr.test +++ b/lld/test/elf/tlsAddr.test @@ -4,4 +4,4 @@ RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tlsAddr.x86-64 -static \ RUN: -o %t --noinhibit-exec RUN: llvm-objdump -section-headers %t | FileCheck -check-prefix=CHECKADDR %s -CHECKADDR: {{[0-9]+}} .data 00000000 0000000000401008 DATA +CHECKADDR: {{[0-9]+}} .data 00000000 0000000000401008 DATA |