Skip to content

Fix clang 16.0.4 Compilation on Windows#678

Closed
Pigrecos wants to merge 7 commits intolifting-bits:masterfrom
Pigrecos:master
Closed

Fix clang 16.0.4 Compilation on Windows#678
Pigrecos wants to merge 7 commits intolifting-bits:masterfrom
Pigrecos:master

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.

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
Contributor

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
Contributor

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
Contributor

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
Contributor

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
Contributor

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
Contributor

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?

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

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
Contributor

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?

moved_c = ret;
return ret;
}
case llvm::Instruction::Select: {
Copy link
Contributor

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
Contributor

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(
    ...
  }
}

LLVM_VERSION=llvm-16
return 0
;;
17)
Copy link
Contributor

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
Contributor

Choose a reason for hiding this comment

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

Why?

mrexodia added a commit to LLVMParty/remill that referenced this pull request Oct 29, 2025
mrexodia added a commit to LLVMParty/remill that referenced this pull request Oct 31, 2025
@mrexodia mrexodia mentioned this pull request Oct 31, 2025
10 tasks
@kyle-elliott-tob
Copy link
Collaborator

Closing in favor of #723

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.

5 participants