Skip to content

Commit

Permalink
RuntimeLibrary: Add skeleton runtime library
Browse files Browse the repository at this point in the history
Very basic runtime library.

Signed-off-by: Hyeonggon Yoo <[email protected]>
  • Loading branch information
hygoni committed Jan 17, 2024
1 parent 9d2d933 commit 9767e72
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ link_directories(${LLVM_LIBRARY_DIRS})

# Our pass lives in this subdirectory.
add_subdirectory(PreciseLeakSanitizer)
add_subdirectory(RuntimeLibrary)
1 change: 1 addition & 0 deletions RuntimeLibrary/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_library(plsan plsan.cpp)
32 changes: 32 additions & 0 deletions RuntimeLibrary/plsan.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* READ THIS:
* The name of a function here must start with double underscores to avoid
* collisons with the program. For example: __foo(), __bar(), etc.
*/

#include <cstddef>

/* Initialization routines called before main() */
__attribute__((constructor))
void __plsan_init() {
/* TODO: */
}

void __plsan_alloc(void *addr, size_t size)
{
/* TODO: initialize references */
}

void __plsan_store(void **addr, void *value)
{
/* TODO: update references */
}

void __plsan_exit_func()
{
/*
* TODO: check if
* 1) the address of lost meomry is written back to memory before
* returning the function
* 2) or the address of a buffer is return value
*/
}

0 comments on commit 9767e72

Please sign in to comment.