mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
Drop the udis86 wrapper from llvm::sys
This optional dependency on the udis86 library was added some time back to aid JIT development, but doesn't make much sense to link into LLVM binaries these days. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1497,25 +1497,6 @@ if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then
|
|||||||
AC_CHECK_LIB(z, compress2)
|
AC_CHECK_LIB(z, compress2)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Allow extra x86-disassembler library
|
|
||||||
AC_ARG_WITH(udis86,
|
|
||||||
AS_HELP_STRING([--with-udis86=<path>],
|
|
||||||
[Use udis86 external x86 disassembler library]),
|
|
||||||
[
|
|
||||||
AC_SUBST(USE_UDIS86, [1])
|
|
||||||
case "$withval" in
|
|
||||||
/usr/lib|yes) ;;
|
|
||||||
*) LDFLAGS="$LDFLAGS -L${withval}" ;;
|
|
||||||
esac
|
|
||||||
AC_CHECK_LIB(udis86, ud_init, [], [
|
|
||||||
echo "Error! You need to have libudis86 around."
|
|
||||||
exit -1
|
|
||||||
])
|
|
||||||
],
|
|
||||||
AC_SUBST(USE_UDIS86, [0]))
|
|
||||||
AC_DEFINE_UNQUOTED([USE_UDIS86],$USE_UDIS86,
|
|
||||||
[Define if use udis86 library])
|
|
||||||
|
|
||||||
dnl Allow OProfile support for JIT output.
|
dnl Allow OProfile support for JIT output.
|
||||||
AC_ARG_WITH(oprofile,
|
AC_ARG_WITH(oprofile,
|
||||||
AS_HELP_STRING([--with-oprofile=<prefix>],
|
AS_HELP_STRING([--with-oprofile=<prefix>],
|
||||||
|
@ -713,13 +713,6 @@ The following options can be used to set or enable LLVM specific options:
|
|||||||
generating the documentation can take a long time and producess 100s of
|
generating the documentation can take a long time and producess 100s of
|
||||||
megabytes of output.
|
megabytes of output.
|
||||||
|
|
||||||
``--with-udis86``
|
|
||||||
|
|
||||||
LLVM can use external disassembler library for various purposes (now it's used
|
|
||||||
only for examining code produced by JIT). This option will enable usage of
|
|
||||||
`udis86 <http://udis86.sourceforge.net/>`_ x86 (both 32 and 64 bits)
|
|
||||||
disassembler library.
|
|
||||||
|
|
||||||
To configure LLVM, follow these steps:
|
To configure LLVM, follow these steps:
|
||||||
|
|
||||||
#. Change directory into the object root directory:
|
#. Change directory into the object root directory:
|
||||||
|
@ -179,9 +179,6 @@
|
|||||||
/* Define to 1 if you have the `shell32' library (-lshell32). */
|
/* Define to 1 if you have the `shell32' library (-lshell32). */
|
||||||
#cmakedefine HAVE_LIBSHELL32 ${HAVE_LIBSHELL32}
|
#cmakedefine HAVE_LIBSHELL32 ${HAVE_LIBSHELL32}
|
||||||
|
|
||||||
/* Define to 1 if you have the `udis86' library (-ludis86). */
|
|
||||||
#undef HAVE_LIBUDIS86
|
|
||||||
|
|
||||||
/* Define to 1 if you have the 'z' library (-lz). */
|
/* Define to 1 if you have the 'z' library (-lz). */
|
||||||
#cmakedefine HAVE_LIBZ ${HAVE_LIBZ}
|
#cmakedefine HAVE_LIBZ ${HAVE_LIBZ}
|
||||||
|
|
||||||
@ -518,9 +515,6 @@
|
|||||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||||
#undef TM_IN_SYS_TIME
|
#undef TM_IN_SYS_TIME
|
||||||
|
|
||||||
/* Define if use udis86 library */
|
|
||||||
#undef USE_UDIS86
|
|
||||||
|
|
||||||
/* Type of 1st arg on ELM Callback */
|
/* Type of 1st arg on ELM Callback */
|
||||||
#cmakedefine WIN32_ELMCB_PCSTR ${WIN32_ELMCB_PCSTR}
|
#cmakedefine WIN32_ELMCB_PCSTR ${WIN32_ELMCB_PCSTR}
|
||||||
|
|
||||||
|
@ -161,9 +161,6 @@
|
|||||||
/* Define to 1 if you have the `shell32' library (-lshell32). */
|
/* Define to 1 if you have the `shell32' library (-lshell32). */
|
||||||
#undef HAVE_LIBSHELL32
|
#undef HAVE_LIBSHELL32
|
||||||
|
|
||||||
/* Define to 1 if you have the `udis86' library (-ludis86). */
|
|
||||||
#undef HAVE_LIBUDIS86
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `z' library (-lz). */
|
/* Define to 1 if you have the `z' library (-lz). */
|
||||||
#undef HAVE_LIBZ
|
#undef HAVE_LIBZ
|
||||||
|
|
||||||
@ -487,9 +484,6 @@
|
|||||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||||
#undef TM_IN_SYS_TIME
|
#undef TM_IN_SYS_TIME
|
||||||
|
|
||||||
/* Define if use udis86 library */
|
|
||||||
#undef USE_UDIS86
|
|
||||||
|
|
||||||
/* Type of 1st arg on ELM Callback */
|
/* Type of 1st arg on ELM Callback */
|
||||||
#undef WIN32_ELMCB_PCSTR
|
#undef WIN32_ELMCB_PCSTR
|
||||||
|
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
//===- llvm/Support/Disassembler.h ------------------------------*- C++ -*-===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is distributed under the University of Illinois Open Source
|
|
||||||
// License. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This file implements the necessary glue to call external disassembler
|
|
||||||
// libraries.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifndef LLVM_SYSTEM_DISASSEMBLER_H
|
|
||||||
#define LLVM_SYSTEM_DISASSEMBLER_H
|
|
||||||
|
|
||||||
#include "llvm/Support/DataTypes.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace llvm {
|
|
||||||
namespace sys {
|
|
||||||
|
|
||||||
/// This function returns true, if there is possible to use some external
|
|
||||||
/// disassembler library. False otherwise.
|
|
||||||
bool hasDisassembler();
|
|
||||||
|
|
||||||
/// This function provides some "glue" code to call external disassembler
|
|
||||||
/// libraries.
|
|
||||||
std::string disassembleBuffer(uint8_t* start, size_t length, uint64_t pc = 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // LLVM_SYSTEM_DISASSEMBLER_H
|
|
@ -36,7 +36,6 @@
|
|||||||
#include "llvm/IR/ValueHandle.h"
|
#include "llvm/IR/ValueHandle.h"
|
||||||
#include "llvm/IR/ValueMap.h"
|
#include "llvm/IR/ValueMap.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/Disassembler.h"
|
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/Memory.h"
|
#include "llvm/Support/Memory.h"
|
||||||
@ -929,11 +928,6 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
|||||||
MemMgr->setMemoryExecutable();
|
MemMgr->setMemoryExecutable();
|
||||||
|
|
||||||
DEBUG({
|
DEBUG({
|
||||||
if (sys::hasDisassembler()) {
|
|
||||||
dbgs() << "JIT: Disassembled code:\n";
|
|
||||||
dbgs() << sys::disassembleBuffer(FnStart, FnEnd-FnStart,
|
|
||||||
(uintptr_t)FnStart);
|
|
||||||
} else {
|
|
||||||
dbgs() << "JIT: Binary code:\n";
|
dbgs() << "JIT: Binary code:\n";
|
||||||
uint8_t* q = FnStart;
|
uint8_t* q = FnStart;
|
||||||
for (int i = 0; q < FnEnd; q += 4, ++i) {
|
for (int i = 0; q < FnEnd; q += 4, ++i) {
|
||||||
@ -955,7 +949,6 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
|
|||||||
dbgs() << '\n';
|
dbgs() << '\n';
|
||||||
}
|
}
|
||||||
dbgs()<< '\n';
|
dbgs()<< '\n';
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (MMI)
|
if (MMI)
|
||||||
|
@ -73,7 +73,6 @@ add_llvm_library(LLVMSupport
|
|||||||
|
|
||||||
# System
|
# System
|
||||||
Atomic.cpp
|
Atomic.cpp
|
||||||
Disassembler.cpp
|
|
||||||
DynamicLibrary.cpp
|
DynamicLibrary.cpp
|
||||||
Errno.cpp
|
Errno.cpp
|
||||||
Host.cpp
|
Host.cpp
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
//===- lib/Support/Disassembler.cpp -----------------------------*- C++ -*-===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is distributed under the University of Illinois Open Source
|
|
||||||
// License. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This file implements the necessary glue to call external disassembler
|
|
||||||
// libraries.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#include "llvm/Support/Disassembler.h"
|
|
||||||
#include "llvm/Config/config.h"
|
|
||||||
#include <cassert>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#if USE_UDIS86
|
|
||||||
#include <udis86.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace llvm;
|
|
||||||
|
|
||||||
bool llvm::sys::hasDisassembler()
|
|
||||||
{
|
|
||||||
#if defined (__i386__) || defined (__amd64__) || defined (__x86_64__)
|
|
||||||
// We have option to enable udis86 library.
|
|
||||||
# if USE_UDIS86
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string llvm::sys::disassembleBuffer(uint8_t* start, size_t length,
|
|
||||||
uint64_t pc) {
|
|
||||||
#if (defined (__i386__) || defined (__amd64__) || defined (__x86_64__)) \
|
|
||||||
&& USE_UDIS86
|
|
||||||
std::stringstream res;
|
|
||||||
|
|
||||||
unsigned bits;
|
|
||||||
# if defined(__i386__)
|
|
||||||
bits = 32;
|
|
||||||
# else
|
|
||||||
bits = 64;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
ud_t ud_obj;
|
|
||||||
|
|
||||||
ud_init(&ud_obj);
|
|
||||||
ud_set_input_buffer(&ud_obj, start, length);
|
|
||||||
ud_set_mode(&ud_obj, bits);
|
|
||||||
ud_set_pc(&ud_obj, pc);
|
|
||||||
ud_set_syntax(&ud_obj, UD_SYN_ATT);
|
|
||||||
|
|
||||||
res << std::setbase(16)
|
|
||||||
<< std::setw(bits/4);
|
|
||||||
|
|
||||||
while (ud_disassemble(&ud_obj)) {
|
|
||||||
res << ud_insn_off(&ud_obj) << ":\t" << ud_insn_asm(&ud_obj) << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return res.str();
|
|
||||||
#else
|
|
||||||
return "No disassembler available. See configure help for options.\n";
|
|
||||||
#endif
|
|
||||||
}
|
|
Reference in New Issue
Block a user