Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ endif()
if( ${TARGET_OS} STREQUAL "Linux" )
set(OS "LINUX")
set(OSNAME "Linux")
elseif( ${TARGET_OS} STREQUAL "Darwin" )
set(OS "OSX")
set(OSNAME "macOS")
else()
message("Unsupported OS: ${TARGET_OS}" )
return()
Expand Down
12 changes: 9 additions & 3 deletions runtime/flang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ endif ()
# flang* executables
SET(CMAKE_Fortran_FLAGS "-B ${LLVM_RUNTIME_OUTPUT_INTDIR} ${CMAKE_Fortran_FLAGS}")

include(CheckSymbolExists)
check_symbol_exists(clock_settime "time.h" HAVE_CLOCK_SETTIME)
configure_file(libflang_config.h.in libflang_config.h)

SET(FTN_INTRINSICS_DESC_INDEP
abort3f.c
access3f.c
Expand Down Expand Up @@ -508,10 +512,12 @@ add_dependencies(flang_shared flang_static)

target_link_libraries(flang_shared flangrti_shared)
# Resolve symbols against libm and librt
if (NOT MSVC)
target_link_libraries(flang_shared m rt)
else()
if (MSVC)
set_target_properties(flang_shared PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
elseif (APPLE)
target_link_libraries(flang_shared m)
else()
target_link_libraries(flang_shared m rt)
endif()

set(SHARED_LIBRARY FALSE)
Expand Down
1 change: 0 additions & 1 deletion runtime/flang/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ typedef char sbool; /* short boolean (for use in large structs) */
#define assert(ex)
#endif

extern char *strcpy();
#define STASH(str) (strcpy((char *)malloc(strlen(str) + 1), str))

/* defs used by __fortio_error */
Expand Down
4 changes: 4 additions & 0 deletions runtime/flang/libflang_config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef LIBFLANG_CONFIG_H
#define LIBFLANG_CONFIG_H
#cmakedefine HAVE_CLOCK_SETTIME
#endif
7 changes: 4 additions & 3 deletions runtime/flang/stime3f.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

/* stime3f.c - Implements LIB3F stime subprogram. */

#ifndef WINNT

#include "libflang_config.h"
#include <time.h>
#include "io3f.h"
#include "ent3f.h"

#ifdef HAVE_CLOCK_SETTIME

int ENT3F(STIME, stime)(int *tp)
{
int i;
Expand All @@ -27,4 +28,4 @@ int ENT3F(STIME, stime)(int *tp)
return i;
}

#endif /* !WINNT */
#endif /* HAVE_CLOCK_SETTIME */
4 changes: 4 additions & 0 deletions runtime/flangrti/ktrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ __ktrap(void)
excepts |= FE_UNDERFLOW;
if (bv & 0x100)
excepts |= FE_INEXACT;
#ifdef TARGET_OSX
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried this on my mac. Neither of __fenv_feenableexcept() or feenableexcept() could be found...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the function was moved from flangrti to libpgmath. https://github.com/flang-compiler/flang/blob/master/runtime/libpgmath/lib/common/fltfenv.c

__fenv_feenableexcept(excepts);
#else
feenableexcept(excepts); /* glibc 2.2 extension to fenv.h */
#endif
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/flangrti/trace_lin.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#else
#include <execinfo.h>
#include <unistd.h>
#include <linux/limits.h>
#include <limits.h>
#include <sys/types.h>
#endif
#include <stdioInterf.h>
Expand Down
1 change: 0 additions & 1 deletion tools/flang1/flang1exe/gbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ char *mkfname(const char *, const char *, const char *); /* from miscutil.c: */
bool is_xflag_bit(int);
void set_xflag(int, INT);
void set_yflag(int, INT);
void bzero(void *, size_t);
void list_init(FILE *); /* listing.c: */
void list_line(const char *); /* listing.c */
void list_page(void); /* listing.c */
Expand Down