diff --git a/aie_runtime_lib/AIE/me_basic.c b/aie_runtime_lib/AIE/me_basic.c deleted file mode 100755 index 15ad676ed4..0000000000 --- a/aie_runtime_lib/AIE/me_basic.c +++ /dev/null @@ -1,112 +0,0 @@ -/* (c) Copyright 2014 - 2020 Xilinx, Inc. All rights reserved. - - This file contains confidential and proprietary information - of Xilinx, Inc. and is protected under U.S. and - international copyright and other intellectual property - laws. - - DISCLAIMER - This disclaimer is not a license and does not grant any - rights to the materials distributed herewith. Except as - otherwise provided in a valid license issued to you by - Xilinx, and to the maximum extent permitted by applicable - law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND - WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES - AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING - BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- - INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and - (2) Xilinx shall not be liable (whether in contract or tort, - including negligence, or under any other theory of - liability) for any loss or damage of any kind or nature - related to, arising under or in connection with these - materials, including for any direct, or any indirect, - special, incidental, or consequential loss or damage - (including loss of data, profits, goodwill, or any type of - loss or damage suffered as a result of any action brought - by a third party) even if such damage or loss was - reasonably foreseeable or Xilinx had been advised of the - possibility of the same. - - CRITICAL APPLICATIONS - Xilinx products are not designed or intended to be fail- - safe, or for use in any application requiring fail-safe - performance, such as life-support or safety devices or - systems, Class III medical devices, nuclear facilities, - applications related to the deployment of airbags, or any - other applications that could lead to death, personal - injury, or severe property or environmental damage - (individually and collectively, "Critical - Applications"). Customer assumes the sole risk and - liability of any use of Xilinx products in Critical - Applications, subject only to applicable laws and - regulations governing limitations on product liability. - - THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS - PART OF THIS FILE AT ALL TIMES. */ - -/* --- File : me_basic.c --- --- Contents : Initial function that calls main for Math Engine (ME). -*/ - -#include - -extern "C" { -// typedef void (*thunk)(); -// extern thunk _ctors_start; // first element -// extern thunk _ctors_end; // past-the-last element -// extern thunk _dtors_start; // first element -// extern thunk _dtors_end; // past-the-last element - -// // the compiler is allowed to consider _start and _end as distinct, but they -// // may be overlayed in reality; access one of them through a chess_copy to -// // prevent optimization of the initial _start/_end non-equality test - -// static inline void _init() { -// // constructors are called in reverse order of the list -// for (thunk* t = &_ctors_end; t-- != chess_copy(&_ctors_start); ) -// (*t)(); -// } - -// void _fini() { -// // destructors in forward order -// for (thunk* t = &_dtors_start; t != chess_copy(&_dtors_end); ++t) -// (*t)(); -// } - -int main(int argc, char *argv[]); - -void _main_init(int argc, char **argv) property(envelope); - -// clang-format off -inline assembly void chess_envelope_open() { - asm_begin - .label __AIE_ARCH_MODEL_VERSION__10012200 global - NOP; MOV.u20 sp, #_sp_start_value_DM_stack // init SP - NOP; MOV.s12 r12, #0 - MOV mc0, r12 // Clear all status bits - MOV mc1, r12 // Clear all status bits - asm_end -} -// clang-format on - -void _main_init(int argc, char **argv) property(envelope) { - me_primitive::control_md0_w = 0; // default: disable saturation and rounding - set_MD(0, 1); // and all floating point exceptions - - // _init(); - - // Statically initialized in atexit.c in libc - // atexit(_fini); - - exit(main(argc, argv)); // run program and stop simulation (never returns) -} - -void __cxa_finalize(void *) {} - -// From me_defs.c -const int chess_storage(% 32) ZERO[8] = {0, 0, 0, 0, 0, 0, 0, 0}; -const int chess_storage(% 32) ONES[8] = {1, 0, 0, 0, 0, 0, 0, 0}; - -} // extern "C" diff --git a/aie_runtime_lib/AIE/me_basic.o b/aie_runtime_lib/AIE/me_basic.o deleted file mode 100644 index 6c8961f7c9..0000000000 Binary files a/aie_runtime_lib/AIE/me_basic.o and /dev/null differ diff --git a/aie_runtime_lib/AIE2/me_basic.c b/aie_runtime_lib/AIE2/me_basic.c deleted file mode 100755 index a2fca15bfa..0000000000 --- a/aie_runtime_lib/AIE2/me_basic.c +++ /dev/null @@ -1,107 +0,0 @@ -// 67d7842dbbe25473c3c32b93c0da8047785f30d78e8a024de1b57352245f9689 -/* (c) Copyright 2014 - 2018 Xilinx, Inc. All rights reserved. - - This file contains confidential and proprietary information - of Xilinx, Inc. and is protected under U.S. and - international copyright and other intellectual property - laws. - - DISCLAIMER - This disclaimer is not a license and does not grant any - rights to the materials distributed herewith. Except as - otherwise provided in a valid license issued to you by - Xilinx, and to the maximum extent permitted by applicable - law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND - WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES - AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING - BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- - INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and - (2) Xilinx shall not be liable (whether in contract or tort, - including negligence, or under any other theory of - liability) for any loss or damage of any kind or nature - related to, arising under or in connection with these - materials, including for any direct, or any indirect, - special, incidental, or consequential loss or damage - (including loss of data, profits, goodwill, or any type of - loss or damage suffered as a result of any action brought - by a third party) even if such damage or loss was - reasonably foreseeable or Xilinx had been advised of the - possibility of the same. - - CRITICAL APPLICATIONS - Xilinx products are not designed or intended to be fail- - safe, or for use in any application requiring fail-safe - performance, such as life-support or safety devices or - systems, Class III medical devices, nuclear facilities, - applications related to the deployment of airbags, or any - other applications that could lead to death, personal - injury, or severe property or environmental damage - (individually and collectively, "Critical - Applications"). Customer assumes the sole risk and - liability of any use of Xilinx products in Critical - Applications, subject only to applicable laws and - regulations governing limitations on product liability. - - THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS - PART OF THIS FILE AT ALL TIMES. */ - -/* --- File : me_basic.c --- --- Contents : Initial function that calls main for Math Engine (ME). -*/ - -#include - -extern "C" { - -int main(int argc, char *argv[]); -static inline void _init(); - -int _main_init(int argc, char **argv) property(envelope); - -// clang-format off -inline assembly void chess_envelope_open() { - asm_begin - .label __AIE_ARCH_MODEL_VERSION__20010000 global - MOVXM sp, #_sp_start_value_DM_stack // init SP - asm_end -} -// clang-format on - -// _main_init needs to be the first defined code symbol in this file, since -// it needs to be linked at address 0. -int _main_init(int argc, char **argv) property(envelope) { - _init(); - - // Statically initialized in atexit.c in libc - // atexit(_fini); - - exit(main(argc, argv)); // run program and stop simulation (never returns) - return 0; -} - -typedef void (*thunk)(); -extern thunk _ctors_start; // first element -extern thunk _ctors_end; // past-the-last element -extern thunk _dtors_start; // first element -extern thunk _dtors_end; // past-the-last element - -// the compiler is allowed to consider _start and _end as distinct, but they -// may be overlayed in reality; access one of them through a chess_copy to -// prevent optimization of the initial _start/_end non-equality test - -static inline void _init() { - // constructors are called in reverse order of the list - for (thunk *t = &_ctors_end; t-- != chess_copy(&_ctors_start);) - (*t)(); -} - -void _fini() { - // destructors in forward order - for (thunk *t = &_dtors_start; t != chess_copy(&_dtors_end); ++t) - (*t)(); -} - -void __cxa_finalize(void *) {} -} diff --git a/aie_runtime_lib/AIE2/me_basic.o b/aie_runtime_lib/AIE2/me_basic.o deleted file mode 100644 index e274c186c7..0000000000 Binary files a/aie_runtime_lib/AIE2/me_basic.o and /dev/null differ diff --git a/aie_runtime_lib/CMakeLists.txt b/aie_runtime_lib/CMakeLists.txt index 89221fbd96..acaa868430 100644 --- a/aie_runtime_lib/CMakeLists.txt +++ b/aie_runtime_lib/CMakeLists.txt @@ -10,26 +10,6 @@ add_custom_target(aie-runtime-libs ALL) function(add_aie_runtime_libs arch) add_custom_target(${arch}_me_basic ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/me_basic.o) - if(DEFINED VITIS_ROOT) - # Compile me_basic.o - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/me_basic.o - COMMAND ${VITIS_XCHESSCC} -p me -P ${VITIS_${arch}_INCLUDE_DIR} - -C Release - -I ${VITIS_${arch}_INCLUDE_DIR}/runtime/include/ - -d -c ${CMAKE_CURRENT_SOURCE_DIR}/me_basic.c - -o ${CMAKE_CURRENT_BINARY_DIR}/me_basic.o - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/me_basic.c) - else() - # Exists in the source tree.. just copy it. - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/me_basic.o - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/me_basic.o - ${CMAKE_CURRENT_BINARY_DIR}/me_basic.o - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/me_basic.o) - endif() - add_dependencies(aie-runtime-libs ${arch}_me_basic) - - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/me_basic.o DESTINATION ${CMAKE_INSTALL_PREFIX}/aie_runtime_lib/${arch}) - # Precompile the intrinsic wrappers. if(DEFINED VITIS_ROOT) add_custom_target(${arch}_chess_intrinsic_wrapper ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/chess_intrinsic_wrapper.ll) diff --git a/lib/Targets/AIETargetLdScript.cpp b/lib/Targets/AIETargetLdScript.cpp index 9c21a5aee4..4e4666064f 100644 --- a/lib/Targets/AIETargetLdScript.cpp +++ b/lib/Targets/AIETargetLdScript.cpp @@ -103,8 +103,8 @@ SECTIONS { . = 0x0; .text : { - /* the _main_init symbol from me_basic.o has to come at address zero. */ - *me_basic.o(.text) + /* the _main_init symbol has to come at address zero. */ + *crt0.o(.text) . = 0x200; _ctors_start = .; _init_array_start = .; @@ -162,7 +162,7 @@ SECTIONS if (auto fileAttr = coreOp.getLinkWith()) output << "INPUT(" << fileAttr.value().str() << ")\n"; - output << "PROVIDE(_main = core_" << tile.getCol() << "_" + output << "PROVIDE(main = core_" << tile.getCol() << "_" << tile.getRow() << ");\n"; } } diff --git a/python/compiler/aiecc/main.py b/python/compiler/aiecc/main.py index 21b31fbf31..8ba9db9b84 100644 --- a/python/compiler/aiecc/main.py +++ b/python/compiler/aiecc/main.py @@ -454,31 +454,8 @@ async def process_core( runtime_lib_path = os.path.join( install_path, "aie_runtime_lib", aie_target.upper() ) - clang_path = os.path.dirname(shutil.which("clang")) - # The build path for libc can be very different from where it's installed. - llvmlibc_build_lib_path = os.path.join( - clang_path, - "..", - "runtimes", - "runtimes-" + aie_target.lower() + "-none-unknown-elf-bins", - "libc", - "lib", - "libc.a", - ) - llvmlibc_install_lib_path = os.path.join( - clang_path, - "..", - "lib", - aie_target.lower() + "-none-unknown-elf", - "libc.a", - ) - me_basic_o = os.path.join(runtime_lib_path, "me_basic.o") - if os.path.isfile(llvmlibc_build_lib_path): - libc = llvmlibc_build_lib_path - else: - libc = llvmlibc_install_lib_path - clang_link_args = [me_basic_o, libc, "-Wl,--gc-sections"] + clang_link_args = ["-Wl,--gc-sections"] if opts.progress: task = self.progress_bar.add_task( diff --git a/test/generate-mmap/test_mmap0.mlir b/test/generate-mmap/test_mmap0.mlir index 6322eb47fb..b0a7b17c40 100644 --- a/test/generate-mmap/test_mmap0.mlir +++ b/test/generate-mmap/test_mmap0.mlir @@ -83,8 +83,8 @@ // LD44-NEXT: { // LD44-NEXT: . = 0x0; // LD44-NEXT: .text : { -// LD44-NEXT: /* the _main_init symbol from me_basic.o has to come at address zero. */ -// LD44-NEXT: *me_basic.o(.text) +// LD44-NEXT: /* the _main_init symbol has to come at address zero. */ +// LD44-NEXT: *crt0.o(.text) // LD44-NEXT: . = 0x200; // LD44-NEXT: _ctors_start = .; // LD44-NEXT: _init_array_start = .;