[sledge] Improve build of model/cxxabi.bc

Summary:
Make could get confused and use both the $(MODEL_DIR)/cxxabi.bc and
%.bc rules, leading to build failure.

Reviewed By: jvillard

Differential Revision: D14385600

fbshipit-source-id: 05f0ac6e1
master
Josh Berdine 6 years ago committed by Facebook Github Bot
parent f4c6072a59
commit 2f55acf8e1

@ -0,0 +1,27 @@
# Copyright (c) 2019-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# additional arguments to pass to clang
OPT_ARGS?=-Os
CLANG_ARGS?=-g $(OPT_ARGS)
# select llvm and clang
SWITCH?=$(shell opam switch show)
LLVM?=../llvm/_install/$(SWITCH)
LIBCXXABI=../llvm/projects/libcxxabi
cxxabi.bc : cxxabi.cpp
$(LLVM)/bin/clang $(CLANG_ARGS) -I$(LLVM)/include/c++/v1 -I$(LIBCXXABI)/include -I$(LIBCXXABI)/src -c -emit-llvm cxxabi.cpp
clean:
rm cxxabi.bc
fmt:
clang-format -i *.h *.c *.cpp
# print any variable for Makefile debugging
print-%:
@printf '$*='; printf '$($*)'; printf '\n'

@ -5,9 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/
/* A simple implementation of the Itanium Base ABI for analysis purposes.
See http://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html */
#include "abort_message.cpp"
#include "cxa_exception.cpp"
#include "cxa_exception_storage.cpp"

@ -5,7 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((noreturn)) void __llair_throw(void* thrown_exception);
#ifdef __cplusplus
}
#endif

@ -38,19 +38,21 @@ Outs:=$(patsubst %.bc,%.bc.out,$(TestBCs)) $(patsubst %.ll,%.ll.out,$(TestLLs))
default: test
$(MODEL_DIR)/cxxabi.bc: $(MODEL_DIR)/cxxabi.cpp
@(cd $(MODEL_DIR) && clang $(CLANG_ARGS) -I../llvm/projects/libcxxabi/include -I../llvm/projects/libcxxabi/src -c -emit-llvm cxxabi.cpp)
$(MODEL_DIR)/cxxabi.bc : $(MODEL_DIR)/cxxabi.cpp
@(cd $(dir $@) && clang $(CLANG_ARGS) -I../llvm/projects/libcxxabi/include -I../llvm/projects/libcxxabi/src -c -emit-llvm cxxabi.cpp)
# compile c to llvm bitcode
%.bc : %.c $(MODEL_DIR)/cxxabi.bc
@(cd $(dir $*) && clang $(CLANG_ARGS) -c -emit-llvm $(notdir $*).c -o - | opt $(OPT_ARGS) -o $(notdir $*).bc)
# $(MODEL_DIR)/cxxabi.bc
# @(cd $(dir $*) && clang $(CLANG_ARGS) -c -emit-llvm $(notdir $*).c -o - | llvm-link $(MODEL_DIR)/cxxabi.bc - | opt $(OPT_ARGS) -o $(notdir $*).bc)
# compile c++ to llvm bitcode
%.bc : %.cpp $(MODEL_DIR)/cxxabi.bc
%.bc : %.cpp
@(cd $(dir $*) && clang $(CLANG_ARGS) -c -emit-llvm $(notdir $*).cpp -o - | opt $(OPT_ARGS) -o $(notdir $*).bc)
# $(MODEL_DIR)/cxxabi.bc
# @(cd $(dir $*) && clang $(CLANG_ARGS) -c -emit-llvm $(notdir $*).cpp -o - | llvm-link $(MODEL_DIR)/cxxabi.bc - | opt $(OPT_ARGS) -o $(notdir $*).bc)
# disassemble bitcode to llvm assembly

Loading…
Cancel
Save