From 57c2fa9d11f45618e25798eb2065c1b14b847264 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 11 Mar 2011 18:17:57 -0800 Subject: Rename libsupport to librustllvm --- src/Makefile | 16 ++++---- src/llvmext/Object.cpp | 55 +++++++++++++++++++++++++++ src/llvmext/README | 3 ++ src/llvmext/include/llvm-c/Object.h | 75 +++++++++++++++++++++++++++++++++++++ src/support/Object.cpp | 55 --------------------------- src/support/README | 3 -- src/support/include/llvm-c/Object.h | 75 ------------------------------------- 7 files changed, 141 insertions(+), 141 deletions(-) create mode 100644 src/llvmext/Object.cpp create mode 100644 src/llvmext/README create mode 100644 src/llvmext/include/llvm-c/Object.h delete mode 100644 src/support/Object.cpp delete mode 100644 src/support/README delete mode 100644 src/support/include/llvm-c/Object.h (limited to 'src') diff --git a/src/Makefile b/src/Makefile index dc6a78a5..47365a7c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -34,7 +34,7 @@ DSYMUTIL := true ifeq ($(CFG_OSTYPE), FreeBSD) CFG_RUNTIME := librustrt.so - CFG_SUPPORT := librustsupport.so + CFG_SUPPORT := librustllvm.so CFG_STDLIB := libstd.so CFG_GCC_CFLAGS += -fPIC -march=i686 -I/usr/local/include CFG_GCC_LINK_FLAGS += -shared -fPIC -lpthread -lrt @@ -48,7 +48,7 @@ endif ifeq ($(CFG_OSTYPE), Linux) CFG_RUNTIME := librustrt.so - CFG_SUPPORT := librustsupport.so + CFG_SUPPORT := librustllvm.so CFG_STDLIB := libstd.so CFG_GCC_CFLAGS += -fPIC -march=i686 CFG_GCC_LINK_FLAGS += -shared -fPIC -ldl -lpthread -lrt @@ -62,7 +62,7 @@ endif ifeq ($(CFG_OSTYPE), Darwin) CFG_RUNTIME := librustrt.dylib - CFG_SUPPORT := librustsupport.dylib + CFG_SUPPORT := librustllvm.dylib CFG_STDLIB := libstd.dylib CFG_UNIXY := 1 CFG_GCC_LINK_FLAGS += -dynamiclib -lpthread @@ -88,7 +88,7 @@ ifdef CFG_WINDOWSY CFG_NATIVE := 1 endif CFG_RUNTIME := rustrt.dll - CFG_SUPPORT := rustsupport.dll + CFG_SUPPORT := rustllvm.dll CFG_STDLIB := std.dll CFG_EXE_SUFFIX := .exe CFG_BOOT := ./rustboot.exe @@ -111,7 +111,7 @@ ifdef CFG_UNIXY CFG_GCC_CROSS := i586-mingw32msvc- CFG_BOOT_FLAGS += -t win32-x86-pe CFG_RUNTIME := rustrt.dll - CFG_SUPPORT := rustsupport.dll + CFG_SUPPORT := rustllvm.dll CFG_STDLIB := std.dll CFG_RUSTC := ./rustc.exe ifdef CFG_VALGRIND @@ -310,9 +310,9 @@ RUNTIME_HDR := rt/globals.h \ RUNTIME_INCS := -Irt/isaac -Irt/uthash RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o) -SUPPORT_CS := support/Object.cpp +SUPPORT_CS := llvmext/Object.cpp -SUPPORT_HDR := support/include/llvm-c/Object.h +SUPPORT_HDR := llvmext/include/llvm-c/Object.h SUPPORT_INCS := -iquote $(CFG_LLVM_INCDIR) SUPPORT_OBJS := $(SUPPORT_CS:.cpp=.o) @@ -351,7 +351,7 @@ rt/%.o: rt/%.cpp $(MKFILES) @$(call CFG_ECHO, compile: $<) $(CFG_QUIET)$(call CFG_COMPILE_C, $@, $(RUNTIME_INCS)) $< -support/%.o: support/%.cpp $(MKFILES) +llvmext/%.o: llvmext/%.cpp $(MKFILES) @$(call CFG_ECHO, compile: $<) $(CFG_QUIET)$(call CFG_COMPILE_C, $@, $(CFG_LLVM_CXXFLAGS) \ $(SUPPORT_INCS)) $< diff --git a/src/llvmext/Object.cpp b/src/llvmext/Object.cpp new file mode 100644 index 00000000..f390870f --- /dev/null +++ b/src/llvmext/Object.cpp @@ -0,0 +1,55 @@ +//===- Object.cpp - C bindings to the object file library--------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the C bindings to the file-format-independent object +// library. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Object/ObjectFile.h" +#include "llvm-c/Object.h" + +using namespace llvm; +using namespace object; + +LLVMObjectFileRef LLVMCreateObjectFile(const char *ObjectPath) { + StringRef SR(ObjectPath); + return wrap(ObjectFile::createObjectFile(SR)); +} + +void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile) { + delete unwrap(ObjectFile); +} + +LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile) { + ObjectFile::section_iterator SI = unwrap(ObjectFile)->begin_sections(); + return wrap(new ObjectFile::section_iterator(SI)); +} + +void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI) { + delete unwrap(SI); +} + +void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) { + ObjectFile::section_iterator UnwrappedSI = *unwrap(SI); + ++UnwrappedSI; +} + +const char *LLVMGetSectionName(LLVMSectionIteratorRef SI) { + return (*unwrap(SI))->getName().data(); +} + +uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI) { + return (*unwrap(SI))->getSize(); +} + +const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) { + return (*unwrap(SI))->getContents().data(); +} + diff --git a/src/llvmext/README b/src/llvmext/README new file mode 100644 index 00000000..31495f22 --- /dev/null +++ b/src/llvmext/README @@ -0,0 +1,3 @@ +This directory currently contains some LLVM support code. This will generally +be sent upstream to LLVM in time; for now it lives here. + diff --git a/src/llvmext/include/llvm-c/Object.h b/src/llvmext/include/llvm-c/Object.h new file mode 100644 index 00000000..a65a2352 --- /dev/null +++ b/src/llvmext/include/llvm-c/Object.h @@ -0,0 +1,75 @@ +/*===-- llvm-c/Object.h - Object Lib C Iface --------------------*- C++ -*-===*/ +/* */ +/* The LLVM Compiler Infrastructure */ +/* */ +/* This file is distributed under the University of Illinois Open Source */ +/* License. See LICENSE.TXT for details. */ +/* */ +/*===----------------------------------------------------------------------===*/ +/* */ +/* This header declares the C interface to libLLVMObject.a, which */ +/* implements object file reading and writing. */ +/* */ +/* Many exotic languages can interoperate with C code but have a harder time */ +/* with C++ due to name mangling. So in addition to C, this interface enables */ +/* tools written in such languages. */ +/* */ +/*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_C_OBJECT_H +#define LLVM_C_OBJECT_H + +#include "llvm-c/Core.h" +#include "llvm/Config/llvm-config.h" + +#ifdef __cplusplus +#include "llvm/Object/ObjectFile.h" + +extern "C" { +#endif + + +typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef; + +typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef; + +LLVMObjectFileRef LLVMCreateObjectFile(const char *ObjectPath); +void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile); + +LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile); +void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI); +void LLVMMoveToNextSection(LLVMSectionIteratorRef SI); +const char *LLVMGetSectionName(LLVMSectionIteratorRef SI); +uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI); +const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI); + + +#ifdef __cplusplus +} + +namespace llvm { + namespace object { + inline ObjectFile *unwrap(LLVMObjectFileRef OF) { + return reinterpret_cast(OF); + } + + inline LLVMObjectFileRef wrap(const ObjectFile *OF) { + return reinterpret_cast(const_cast(OF)); + } + + inline ObjectFile::section_iterator *unwrap(LLVMSectionIteratorRef SI) { + return reinterpret_cast(SI); + } + + inline LLVMSectionIteratorRef + wrap(const ObjectFile::section_iterator *SI) { + return reinterpret_cast + (const_cast(SI)); + } + } +} + +#endif /* defined(__cplusplus) */ + +#endif + diff --git a/src/support/Object.cpp b/src/support/Object.cpp deleted file mode 100644 index f390870f..00000000 --- a/src/support/Object.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===- Object.cpp - C bindings to the object file library--------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the C bindings to the file-format-independent object -// library. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Object/ObjectFile.h" -#include "llvm-c/Object.h" - -using namespace llvm; -using namespace object; - -LLVMObjectFileRef LLVMCreateObjectFile(const char *ObjectPath) { - StringRef SR(ObjectPath); - return wrap(ObjectFile::createObjectFile(SR)); -} - -void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile) { - delete unwrap(ObjectFile); -} - -LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile) { - ObjectFile::section_iterator SI = unwrap(ObjectFile)->begin_sections(); - return wrap(new ObjectFile::section_iterator(SI)); -} - -void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI) { - delete unwrap(SI); -} - -void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) { - ObjectFile::section_iterator UnwrappedSI = *unwrap(SI); - ++UnwrappedSI; -} - -const char *LLVMGetSectionName(LLVMSectionIteratorRef SI) { - return (*unwrap(SI))->getName().data(); -} - -uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI) { - return (*unwrap(SI))->getSize(); -} - -const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) { - return (*unwrap(SI))->getContents().data(); -} - diff --git a/src/support/README b/src/support/README deleted file mode 100644 index 31495f22..00000000 --- a/src/support/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory currently contains some LLVM support code. This will generally -be sent upstream to LLVM in time; for now it lives here. - diff --git a/src/support/include/llvm-c/Object.h b/src/support/include/llvm-c/Object.h deleted file mode 100644 index a65a2352..00000000 --- a/src/support/include/llvm-c/Object.h +++ /dev/null @@ -1,75 +0,0 @@ -/*===-- llvm-c/Object.h - Object Lib C Iface --------------------*- C++ -*-===*/ -/* */ -/* The LLVM Compiler Infrastructure */ -/* */ -/* This file is distributed under the University of Illinois Open Source */ -/* License. See LICENSE.TXT for details. */ -/* */ -/*===----------------------------------------------------------------------===*/ -/* */ -/* This header declares the C interface to libLLVMObject.a, which */ -/* implements object file reading and writing. */ -/* */ -/* Many exotic languages can interoperate with C code but have a harder time */ -/* with C++ due to name mangling. So in addition to C, this interface enables */ -/* tools written in such languages. */ -/* */ -/*===----------------------------------------------------------------------===*/ - -#ifndef LLVM_C_OBJECT_H -#define LLVM_C_OBJECT_H - -#include "llvm-c/Core.h" -#include "llvm/Config/llvm-config.h" - -#ifdef __cplusplus -#include "llvm/Object/ObjectFile.h" - -extern "C" { -#endif - - -typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef; - -typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef; - -LLVMObjectFileRef LLVMCreateObjectFile(const char *ObjectPath); -void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile); - -LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile); -void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI); -void LLVMMoveToNextSection(LLVMSectionIteratorRef SI); -const char *LLVMGetSectionName(LLVMSectionIteratorRef SI); -uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI); -const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI); - - -#ifdef __cplusplus -} - -namespace llvm { - namespace object { - inline ObjectFile *unwrap(LLVMObjectFileRef OF) { - return reinterpret_cast(OF); - } - - inline LLVMObjectFileRef wrap(const ObjectFile *OF) { - return reinterpret_cast(const_cast(OF)); - } - - inline ObjectFile::section_iterator *unwrap(LLVMSectionIteratorRef SI) { - return reinterpret_cast(SI); - } - - inline LLVMSectionIteratorRef - wrap(const ObjectFile::section_iterator *SI) { - return reinterpret_cast - (const_cast(SI)); - } - } -} - -#endif /* defined(__cplusplus) */ - -#endif - -- cgit v1.2.3