mirror of
https://github.com/lifting-bits/remill
synced 2026-06-21 13:56:07 +00:00
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Trail of Bits, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef REMILL_BC_COMPAT_TOOLOUTPUTFILE_H_
|
||||
#define REMILL_BC_COMPAT_TOOLOUTPUTFILE_H_
|
||||
|
||||
#include "remill/BC/Version.h"
|
||||
#include <llvm/Support/ToolOutputFile.h>
|
||||
|
||||
#if LLVM_VERSION_NUMBER < LLVM_VERSION(6, 0)
|
||||
namespace llvm {
|
||||
using ToolOutputFile = tool_output_file;
|
||||
} // namespace llvm
|
||||
#endif
|
||||
|
||||
#endif // REMILL_BC_COMPAT_TOOLOUTPUTFILE_H_
|
||||
+2
-2
@@ -39,7 +39,6 @@
|
||||
|
||||
#include <llvm/Support/FileSystem.h>
|
||||
#include <llvm/Support/SourceMgr.h>
|
||||
#include <llvm/Support/ToolOutputFile.h>
|
||||
#include <llvm/Support/raw_ostream.h>
|
||||
|
||||
#include "remill/Arch/Name.h"
|
||||
@@ -48,6 +47,7 @@
|
||||
#include "remill/BC/Compat/DebugInfo.h"
|
||||
#include "remill/BC/Compat/GlobalValue.h"
|
||||
#include "remill/BC/Compat/IRReader.h"
|
||||
#include "remill/BC/Compat/ToolOutputFile.h"
|
||||
#include "remill/BC/Compat/Verifier.h"
|
||||
#include "remill/BC/Util.h"
|
||||
#include "remill/BC/Version.h"
|
||||
@@ -289,7 +289,7 @@ bool StoreModuleToFile(llvm::Module *module, std::string file_name,
|
||||
|
||||
#if LLVM_VERSION_NUMBER > LLVM_VERSION(3, 5)
|
||||
std::error_code ec;
|
||||
llvm::tool_output_file bc(tmp_name.c_str(), ec, llvm::sys::fs::F_RW);
|
||||
llvm::ToolOutputFile bc(tmp_name.c_str(), ec, llvm::sys::fs::F_RW);
|
||||
CHECK(!ec) << "Unable to open output bitcode file for writing: " << tmp_name;
|
||||
#else
|
||||
llvm::tool_output_file bc(tmp_name.c_str(), error, llvm::sys::fs::F_RW);
|
||||
|
||||
+8
-1
@@ -493,8 +493,15 @@ static void ResetFlags(void) {
|
||||
// but the logic in older versions (like eglibc 2.19, used on some Ubuntu 14.04 installations)
|
||||
// does not clear exception flags and also does *not* ignore denormal exceptions
|
||||
// see: https://sourceware.org/ml/libc-alpha/2015-10/msg01020.html
|
||||
#if !defined(FE_DENORMALOPERAND) && defined(__FE_DENORM)
|
||||
# define FE_DENORMALOPERAND __FE_DENORM
|
||||
#endif
|
||||
#if !defined(FE_DENORMALOPERAND)
|
||||
# warning "Missing FE_DENORMALOPERAND."
|
||||
# define FE_DENORMALOPERAND 0x2
|
||||
#endif
|
||||
static void FixGlibcMxcsrBug() {
|
||||
const uint32_t FE_ALL_EXCEPT_X86 = (FE_ALL_EXCEPT | __FE_DENORM);
|
||||
const uint32_t FE_ALL_EXCEPT_X86 = (FE_ALL_EXCEPT | FE_DENORMALOPERAND);
|
||||
uint32_t mxcsr = 0; // temporarily holds our MXCSR
|
||||
asm("stmxcsr %0;" : "=m"(mxcsr));
|
||||
// assumes the rest of MXCSR was sanely set by std::fesetenv(FE_DFL_ENV);
|
||||
|
||||
@@ -23,6 +23,6 @@ endif ()
|
||||
|
||||
if (307 LESS ${REMILL_LLVM_VERSION_NUMBER})
|
||||
if (EXISTS ${CMAKE_SOURCE_DIR}/tools/vmill)
|
||||
add_subdirectory(vmill)
|
||||
# add_subdirectory(vmill)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
Reference in New Issue
Block a user