mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
f0356fe140
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes GlobalValues now, and doesn't provide modules, it's renamed to "GVMaterializer". Code that used to need a ModuleProvider to materialize Functions can now materialize the Functions directly. Functions no longer use a magic linkage to record that they're materializable; they simply ask the GVMaterializer. Because the C ABI must never change, we can't remove LLVMModuleProviderRef or the functions that refer to it. Instead, because Module now exposes the same functionality ModuleProvider used to, we store a Module* in any LLVMModuleProviderRef and translate in the wrapper methods. The bindings to other languages still use the ModuleProvider concept. It would probably be worth some time to update them to follow the C++ more closely, but I don't intend to do it. Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94686 91177308-0d34-0410-b5e6-96231b3b80d8
90 lines
3.1 KiB
C++
90 lines
3.1 KiB
C++
//===-- lib/Archive/ArchiveInternals.h -------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Internal implementation header for LLVM Archive files.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LIB_ARCHIVE_ARCHIVEINTERNALS_H
|
|
#define LIB_ARCHIVE_ARCHIVEINTERNALS_H
|
|
|
|
#include "llvm/Bitcode/Archive.h"
|
|
#include "llvm/System/TimeValue.h"
|
|
#include "llvm/ADT/StringExtras.h"
|
|
|
|
#include <cstring>
|
|
|
|
#define ARFILE_MAGIC "!<arch>\n" ///< magic string
|
|
#define ARFILE_MAGIC_LEN (sizeof(ARFILE_MAGIC)-1) ///< length of magic string
|
|
#define ARFILE_SVR4_SYMTAB_NAME "/ " ///< SVR4 symtab entry name
|
|
#define ARFILE_LLVM_SYMTAB_NAME "#_LLVM_SYM_TAB_#" ///< LLVM symtab entry name
|
|
#define ARFILE_BSD4_SYMTAB_NAME "__.SYMDEF SORTED" ///< BSD4 symtab entry name
|
|
#define ARFILE_STRTAB_NAME "// " ///< Name of string table
|
|
#define ARFILE_PAD "\n" ///< inter-file align padding
|
|
#define ARFILE_MEMBER_MAGIC "`\n" ///< fmag field magic #
|
|
|
|
namespace llvm {
|
|
|
|
class LLVMContext;
|
|
|
|
/// The ArchiveMemberHeader structure is used internally for bitcode
|
|
/// archives.
|
|
/// The header precedes each file member in the archive. This structure is
|
|
/// defined using character arrays for direct and correct interpretation
|
|
/// regardless of the endianess of the machine that produced it.
|
|
/// @brief Archive File Member Header
|
|
class ArchiveMemberHeader {
|
|
/// @name Data
|
|
/// @{
|
|
public:
|
|
char name[16]; ///< Name of the file member.
|
|
char date[12]; ///< File date, decimal seconds since Epoch
|
|
char uid[6]; ///< user id in ASCII decimal
|
|
char gid[6]; ///< group id in ASCII decimal
|
|
char mode[8]; ///< file mode in ASCII octal
|
|
char size[10]; ///< file size in ASCII decimal
|
|
char fmag[2]; ///< Always contains ARFILE_MAGIC_TERMINATOR
|
|
|
|
/// @}
|
|
/// @name Methods
|
|
/// @{
|
|
public:
|
|
void init() {
|
|
memset(name,' ',16);
|
|
memset(date,' ',12);
|
|
memset(uid,' ',6);
|
|
memset(gid,' ',6);
|
|
memset(mode,' ',8);
|
|
memset(size,' ',10);
|
|
fmag[0] = '`';
|
|
fmag[1] = '\n';
|
|
}
|
|
|
|
bool checkSignature() {
|
|
return 0 == memcmp(fmag, ARFILE_MEMBER_MAGIC,2);
|
|
}
|
|
};
|
|
|
|
// Get just the externally visible defined symbols from the bitcode
|
|
bool GetBitcodeSymbols(const sys::Path& fName,
|
|
LLVMContext& Context,
|
|
std::vector<std::string>& symbols,
|
|
std::string* ErrMsg);
|
|
|
|
Module* GetBitcodeSymbols(const unsigned char*Buffer,unsigned Length,
|
|
const std::string& ModuleID,
|
|
LLVMContext& Context,
|
|
std::vector<std::string>& symbols,
|
|
std::string* ErrMsg);
|
|
}
|
|
|
|
#endif
|
|
|
|
// vim: sw=2 ai
|