Index: lld/trunk/CMakeLists.txt =================================================================== --- lld/trunk/CMakeLists.txt +++ lld/trunk/CMakeLists.txt @@ -88,7 +88,6 @@ add_subdirectory(lib) add_subdirectory(tools) -add_subdirectory(utils) add_subdirectory(test) Index: lld/trunk/Makefile =================================================================== --- lld/trunk/Makefile +++ lld/trunk/Makefile @@ -14,7 +14,7 @@ IS_TOP_LEVEL := 1 LLD_LEVEL := . -DIRS := include lib tools utils unittests +DIRS := include lib tools unittests PARALLEL_DIRS := Index: lld/trunk/tools/CMakeLists.txt =================================================================== --- lld/trunk/tools/CMakeLists.txt +++ lld/trunk/tools/CMakeLists.txt @@ -1 +1,2 @@ +add_subdirectory(linker-script-test) add_subdirectory(lld) Index: lld/trunk/tools/Makefile =================================================================== --- lld/trunk/tools/Makefile +++ lld/trunk/tools/Makefile @@ -12,6 +12,6 @@ include $(LLD_LEVEL)/../../Makefile.config -DIRS := lld +PARALLEL_DIRS := linker-script-test lld include $(LLD_LEVEL)/Makefile Index: lld/trunk/tools/linker-script-test/CMakeLists.txt =================================================================== --- lld/trunk/tools/linker-script-test/CMakeLists.txt +++ lld/trunk/tools/linker-script-test/CMakeLists.txt @@ -0,0 +1,8 @@ +add_llvm_executable(linker-script-test + linker-script-test.cpp + ) + +target_link_libraries(linker-script-test + LLVMSupport + lldReaderWriter + ) Index: lld/trunk/tools/linker-script-test/Makefile =================================================================== --- lld/trunk/tools/linker-script-test/Makefile +++ lld/trunk/tools/linker-script-test/Makefile @@ -0,0 +1,24 @@ +##===-------------- linker-script-test/Makefile ----------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===--------------------------------------------------------------------===## + +LLD_LEVEL := ../.. + +TOOLNAME = linker-script-test + +# No plugins, optimize startup time. +TOOL_NO_EXPORTS = 1 + +#include /Makefile.config +LEVEL := $(LLD_LEVEL)/../.. +include $(LEVEL)/Makefile.config + +LINK_COMPONENTS := $(TARGETS_TO_BUILD) +USEDLIBS = lldReaderWriter.a lldCore.a LLVMSupport.a + +include $(LLD_LEVEL)/Makefile Index: lld/trunk/tools/linker-script-test/linker-script-test.cpp =================================================================== --- lld/trunk/tools/linker-script-test/linker-script-test.cpp +++ lld/trunk/tools/linker-script-test/linker-script-test.cpp @@ -0,0 +1,57 @@ +//===- utils/linker-script-test/linker-script-test.cpp --------------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// \brief Tool for testing linker script parsing. +/// +//===----------------------------------------------------------------------===// + +#include "lld/ReaderWriter/LinkerScript.h" + +#include "llvm/Support/PrettyStackTrace.h" +#include "llvm/Support/Signals.h" + +using namespace llvm; +using namespace lld; +using namespace script; + +int main(int argc, const char **argv) { + llvm::sys::PrintStackTraceOnErrorSignal(); + llvm::PrettyStackTraceProgram X(argc, argv); + + { + ErrorOr> mb = + MemoryBuffer::getFileOrSTDIN(argv[1]); + if (std::error_code ec = mb.getError()) { + llvm::errs() << ec.message() << "\n"; + return 1; + } + Lexer l(std::move(mb.get())); + Token tok; + while (true) { + l.lex(tok); + tok.dump(llvm::outs()); + if (tok._kind == Token::eof || tok._kind == Token::unknown) + break; + } + } + { + ErrorOr> mb = + MemoryBuffer::getFileOrSTDIN(argv[1]); + if (std::error_code ec = mb.getError()) { + llvm::errs() << ec.message() << "\n"; + return 1; + } + Parser p(std::move(mb.get())); + if (!p.parse()) { + LinkerScript *ls = p.get(); + ls->dump(llvm::outs()); + } + } +} Index: lld/trunk/utils/CMakeLists.txt =================================================================== --- lld/trunk/utils/CMakeLists.txt +++ lld/trunk/utils/CMakeLists.txt @@ -1 +0,0 @@ -add_subdirectory(linker-script-test) Index: lld/trunk/utils/Makefile =================================================================== --- lld/trunk/utils/Makefile +++ lld/trunk/utils/Makefile @@ -1,17 +0,0 @@ -##===- tools/Makefile --------------------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LLD_LEVEL := .. -LEVEL := $(LLD_LEVEL)/../.. - -include $(LLD_LEVEL)/../../Makefile.config - -DIRS := linker-script-test - -include $(LLD_LEVEL)/Makefile Index: lld/trunk/utils/linker-script-test/CMakeLists.txt =================================================================== --- lld/trunk/utils/linker-script-test/CMakeLists.txt +++ lld/trunk/utils/linker-script-test/CMakeLists.txt @@ -1,8 +0,0 @@ -add_llvm_executable(linker-script-test - linker-script-test.cpp - ) - -target_link_libraries(linker-script-test - LLVMSupport - lldReaderWriter - ) Index: lld/trunk/utils/linker-script-test/Makefile =================================================================== --- lld/trunk/utils/linker-script-test/Makefile +++ lld/trunk/utils/linker-script-test/Makefile @@ -1,24 +0,0 @@ -##===-------------- linker-script-test/Makefile ----------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===--------------------------------------------------------------------===## - -LLD_LEVEL := ../.. - -TOOLNAME = linker-script-test - -# No plugins, optimize startup time. -TOOL_NO_EXPORTS = 1 - -#include /Makefile.config -LEVEL := $(LLD_LEVEL)/../.. -include $(LEVEL)/Makefile.config - -LINK_COMPONENTS := $(TARGETS_TO_BUILD) -USEDLIBS = lldReaderWriter.a lldCore.a LLVMSupport.a - -include $(LLD_LEVEL)/Makefile Index: lld/trunk/utils/linker-script-test/linker-script-test.cpp =================================================================== --- lld/trunk/utils/linker-script-test/linker-script-test.cpp +++ lld/trunk/utils/linker-script-test/linker-script-test.cpp @@ -1,57 +0,0 @@ -//===- utils/linker-script-test/linker-script-test.cpp --------------------===// -// -// The LLVM Linker -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// \brief Tool for testing linker script parsing. -/// -//===----------------------------------------------------------------------===// - -#include "lld/ReaderWriter/LinkerScript.h" - -#include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/Signals.h" - -using namespace llvm; -using namespace lld; -using namespace script; - -int main(int argc, const char **argv) { - llvm::sys::PrintStackTraceOnErrorSignal(); - llvm::PrettyStackTraceProgram X(argc, argv); - - { - ErrorOr> mb = - MemoryBuffer::getFileOrSTDIN(argv[1]); - if (std::error_code ec = mb.getError()) { - llvm::errs() << ec.message() << "\n"; - return 1; - } - Lexer l(std::move(mb.get())); - Token tok; - while (true) { - l.lex(tok); - tok.dump(llvm::outs()); - if (tok._kind == Token::eof || tok._kind == Token::unknown) - break; - } - } - { - ErrorOr> mb = - MemoryBuffer::getFileOrSTDIN(argv[1]); - if (std::error_code ec = mb.getError()) { - llvm::errs() << ec.message() << "\n"; - return 1; - } - Parser p(std::move(mb.get())); - if (!p.parse()) { - LinkerScript *ls = p.get(); - ls->dump(llvm::outs()); - } - } -}