Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang 16.0.4 Compilation on Windows #678

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Pigrecos
Copy link

No description provided.

@Pigrecos Pigrecos requested a review from pgoodman as a code owner July 19, 2023 16:01
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -25,6 +25,8 @@ include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/options.cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

set(REMILL_ENABLE_TESTING OFF)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to cmake/options.cmake.

interpreter
mcjit
FrontendOffloading
nvptxdesc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@2over12 thoughts on removing nvptx and wasm from cxx-common?

CMakeLists.txt Outdated
# This then causes a windows compilation failure, because of a conflicting definition
# of 'byte' in one of the windows SDK headers. So as a fix we must append
# _HAS_STD_BYTE to the compile definitions.
add_compile_definitions(_HAS_STD_BYTE=0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to make this specific to a target?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, can this be turned into a PR to sleigh?

CMakeLists.txt Outdated
add_compile_definitions(_HAS_STD_BYTE=0)
# In another sleigh source file, there is an implicit narrowing conversion.
# This flag allows implicit narrowing.
add_compile_options ( -Xclang -Wno-narrowing)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to make this specific to a target?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, can this be turned into a PR to sleigh?

@@ -131,7 +165,9 @@ add_library(remill_settings INTERFACE)

target_include_directories(remill_settings INTERFACE
$<BUILD_INTERFACE:${REMILL_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)
$<INSTALL_INTERFACE:include>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be a $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>, given that GNUInstallDirs is included.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $<INSTALL_INTERFACE> with the GNUInstallDirs is already implicitly adding when exporting the target, so you should be able to actually remove it from the target.

lib/BC/Util.cpp Outdated
case llvm::Instruction::ZExt: {
auto ret = llvm::ConstantExpr::getZExt(
/* case llvm::Instruction::ZExt: {
auto ret = FoldBitCast(c,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why FoldBitCast in a ZExt case?

@@ -1205,17 +1205,6 @@ MoveConstantIntoModule(llvm::Constant *c, llvm::Module *dest_module,
moved_c = ret;
return ret;
}
case llvm::Instruction::Select: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why deleted? Does LLVM no longer support these in constant expressions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they are in the process of gutting the ConstantExpr functionality, this is what's left in LLVM 19: https://github.com/mrexodia/llvm-headers/blob/17bb678153ba1c5c87bb17f6cd36894cb88d5c0d/19.x/llvm/IR/Constants.h#L1101-L1159

@@ -1229,23 +1218,17 @@ MoveConstantIntoModule(llvm::Constant *c, llvm::Module *dest_module,
}
case llvm::Instruction::LShr: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, probably a bunch of cases could be merged as follows:

case llvm::Instruction::Foo:
...
case llvm::Instruction::Bar: {
  if (auto op = llvm::dyn_cast<llvm::BinaryOperator>(...)) {
    ... = ConstantFoldBinaryOpOperands(
    ...
  }
}

@@ -300,6 +300,10 @@ function GetLLVMVersion
LLVM_VERSION=llvm-16
return 0
;;
17)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should drop support for 15 and 16, especially if 17-related changes were made (e.g. dropping constant expression stuff).

"${TEST_RUNNER_INCLUDE_DIR}/test_runner/TestRunner.h"
"${TEST_RUNNER_INCLUDE_DIR}/test_runner/TestOutputSpec.h"
)
#add_library(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants