~aleteoryx/muditaos

915f3334c3a75e6ba24ba1281a8acb4abb8289c3 — Dawid Wojtas 3 years ago fa28808
[MOS-549] Linux simulator crashes on GCC12

Add wrapper for posix stat function
in order to invoke our implementation.
M board/linux/libiosyscalls/CMakeLists.txt => board/linux/libiosyscalls/CMakeLists.txt +2 -0
@@ 26,6 26,8 @@ target_sources(
        src/syscalls_real.hpp
        src/syscalls_scan_family.cpp
        src/syscalls_stdio.cpp
        src/syscalls_common.hpp
        src/syscalls_wrapper.cpp

    PUBLIC
        include/debug.hpp

A board/linux/libiosyscalls/src/syscalls_common.hpp => board/linux/libiosyscalls/src/syscalls_common.hpp +11 -0
@@ 0,0 1,11 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

extern "C"
{
#if __GLIBC__ > 2 || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 33))
    int _iosys_stat(const char *file, struct stat *pstat);
#endif
}

M board/linux/libiosyscalls/src/syscalls_posix.cpp => board/linux/libiosyscalls/src/syscalls_posix.cpp +2 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "iosyscalls-internal.hpp"


@@ 16,6 16,7 @@
#include <unistd.h>

#include "syscalls_real.hpp"
#include "syscalls_common.hpp"

#include "debug.hpp"


A board/linux/libiosyscalls/src/syscalls_wrapper.cpp => board/linux/libiosyscalls/src/syscalls_wrapper.cpp +15 -0
@@ 0,0 1,15 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "syscalls_common.hpp"

extern "C"
{
#if __GLIBC__ > 2 || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 33))
    // Replace ASAN stat to our stat
    int stat(const char *file, struct stat *pstat)
    {
        return _iosys_stat(file, pstat);
    }
#endif
}