Skip to content
Snippets Groups Projects
Commit f49daa84 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'josh_linker_bug' into 'master'

Add a fake initialisation of the equation of state global objects

Closes #626

See merge request swift/swiftsim!959
parents a4312b8a 9b8bf6df
Branches
Tags
1 merge request!959Add a fake initialisation of the equation of state global objects
...@@ -22,4 +22,23 @@ ...@@ -22,4 +22,23 @@
/* Equation of state for the physics model /* Equation of state for the physics model
* (temporary ugly solution as a global variable) */ * (temporary ugly solution as a global variable) */
#ifdef __APPLE__
/*
* The clang compiler and linker on OSX incorrectly optimize
* out the eos global object before the final linking stage, which
* leads to a compilation error.
* The fake initialisation below forces the compiler to keep the
* instance and pass it to the linker stage.
*/
#if defined(EOS_PLANETARY)
struct eos_parameters eos = {.Til_iron.rho_0 = -1.f};
#elif defined(EOS_ISOTHERMAL_GAS)
struct eos_parameters eos = {.isothermal_internal_energy = -1.};
#else
struct eos_parameters eos;
#endif
#else /* i.e. not __APPLE__ */
struct eos_parameters eos; struct eos_parameters eos;
#endif /* __APPLE__ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment