Ticket #10402: 0005-Add-dummy-atexit-to-kernel-and-bootloader.patch

File 0005-Add-dummy-atexit-to-kernel-and-bootloader.patch, 1.3 KB (added by js, 6 years ago)
  • src/system/boot/loader/main.cpp

    From fe4cf8d6fe712066634b6bb3b5753bc6a11acafb Mon Sep 17 00:00:00 2001
    From: Jonathan Schleifer <js@webkeks.org>
    Date: Sun, 12 Jan 2014 17:03:34 +0100
    Subject: [PATCH 5/6] Add dummy atexit() to kernel and bootloader.
    
    Clang registers destructors of global objects using atexit(), therefore
    a dummy is needed.
    ---
     src/system/boot/loader/main.cpp | 11 +++++++++++
     src/system/kernel/main.cpp      | 10 ++++++++++
     2 files changed, 21 insertions(+)
    
    diff --git a/src/system/boot/loader/main.cpp b/src/system/boot/loader/main.cpp
    index c0b8f31..4f9556d 100644
    a b out:  
    150150    heap_release(args);
    151151    return 0;
    152152}
     153
     154
     155/*
     156 * Dummy function, as Clang (unlike GCC) correctly calls dtors of global
     157 * objects using atexit().
     158 */
     159extern "C" int
     160atexit(void (*func)(void))
     161{
     162    return 0;
     163}
  • src/system/kernel/main.cpp

    diff --git a/src/system/kernel/main.cpp b/src/system/kernel/main.cpp
    index ef34cfe..63a30db 100644
    a b main2(void *unused)  
    368368    return 0;
    369369}
    370370
     371
     372/*
     373 * Dummy function, as Clang (unlike GCC) correctly calls dtors of global
     374 * objects using atexit().
     375 */
     376extern "C" int
     377atexit(void (*func)(void))
     378{
     379    return 0;
     380}