Browse Source

scripts: bundle-libraries: fix build on OS X (FS#1493)

This allegedly fixes compilation of the library bundler preload library on
Apple OS X. The resulting executables have not been runtime tested due to a
lack of suitable test hardware.

Signed-off-by: Jo-Philipp Wich <[email protected]>
Jo-Philipp Wich 7 years ago
parent
commit
746c590882
1 changed files with 4 additions and 0 deletions
  1. 4 0
      scripts/bundle-libraries.sh

+ 4 - 0
scripts/bundle-libraries.sh

@@ -87,7 +87,11 @@ _runas_so() {
 			return 0;
 			return 0;
 		}
 		}
 
 
+		#ifdef __APPLE__
+		__attribute__((section("__DATA,__mod_init_func")))
+		#else
 		__attribute__((section(".init_array")))
 		__attribute__((section(".init_array")))
+		#endif
 		static void *mangle_arg0_constructor = &mangle_arg0;
 		static void *mangle_arg0_constructor = &mangle_arg0;
 	EOT
 	EOT