diff options
author | Lukas Larsson <[email protected]> | 2013-10-30 17:56:37 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2014-02-24 15:16:00 +0100 |
commit | a6788ea337a2319a2d1a42ee4618553a1c7765bf (patch) | |
tree | 76bd19e2bf8076a1b19c2e7e0d4215b9469e747e | |
parent | d932131754c2bfb2e0539b6419e3d09533fe84e8 (diff) | |
download | otp-a6788ea337a2319a2d1a42ee4618553a1c7765bf.tar.gz otp-a6788ea337a2319a2d1a42ee4618553a1c7765bf.tar.bz2 otp-a6788ea337a2319a2d1a42ee4618553a1c7765bf.zip |
ose: Fix various build environment issues
-rw-r--r-- | aclocal.m4 | 9 | ||||
-rw-r--r-- | erts/aclocal.m4 | 9 | ||||
-rw-r--r-- | erts/emulator/Makefile.in | 12 | ||||
-rw-r--r-- | erts/emulator/drivers/ose/ose_signal_drv.c | 5 | ||||
-rw-r--r-- | erts/emulator/sys/ose/erl_main.c | 15 | ||||
-rw-r--r-- | erts/emulator/sys/ose/sys.c | 7 | ||||
-rw-r--r-- | erts/epmd/src/Makefile.in | 4 | ||||
-rw-r--r-- | erts/lib_src/ose/ethread.c | 17 | ||||
-rw-r--r-- | lib/erl_interface/aclocal.m4 | 9 | ||||
-rw-r--r-- | lib/megaco/aclocal.m4 | 9 | ||||
-rw-r--r-- | lib/odbc/aclocal.m4 | 9 | ||||
-rw-r--r-- | lib/wx/aclocal.m4 | 9 | ||||
-rw-r--r-- | make/ose_lm.mk.in | 2 | ||||
-rw-r--r-- | xcomp/erl-xcomp-powerpc-ose5.conf | 7 | ||||
-rw-r--r-- | xcomp/erl-xcomp-vars.sh | 2 |
15 files changed, 109 insertions, 16 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 4a3407e0eb..09d0f0194c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -84,6 +84,8 @@ AC_ARG_VAR(erl_xcomp_ose_LM_SET_CONF, [Sets the configuration for an OSE load mo AC_ARG_VAR(erl_xcomp_ose_LM_ELF_SIZE, [Prints the section size information for an OSE load module (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_LCF, [OSE load module linker configuration file (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_CONF, [OSE load module default configuration file (only used when cross compiling for OSE)]) +AC_ARG_VAR(erl_xcomp_ose_CONFD, [OSE OSE confd source file]) +AC_ARG_VAR(erl_xcomp_ose_CRT0_LM, [OSE crt0 lm source file]) ]) @@ -1106,7 +1108,12 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) ;; ose_threads) - AC_DEFINE(ETHR_OSE_THREADS, 1, [Define if you have OSE style threads]) ETHR_THR_LIB_BASE_DIR=ose + AC_DEFINE(ETHR_OSE_THREADS, 1, + [Define if you have OSE style threads]) + ETHR_THR_LIB_BASE_DIR=ose + AC_CHECK_HEADER(ose_spi/ose_spi.h, + AC_DEFINE(HAVE_OSE_SPI, 1, + [Define if you have the "ose_spi/ose_spi.h" header file.])) ;; esac if test "x$THR_LIB_NAME" == "xpthread"; then diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index 4a3407e0eb..09d0f0194c 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -84,6 +84,8 @@ AC_ARG_VAR(erl_xcomp_ose_LM_SET_CONF, [Sets the configuration for an OSE load mo AC_ARG_VAR(erl_xcomp_ose_LM_ELF_SIZE, [Prints the section size information for an OSE load module (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_LCF, [OSE load module linker configuration file (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_CONF, [OSE load module default configuration file (only used when cross compiling for OSE)]) +AC_ARG_VAR(erl_xcomp_ose_CONFD, [OSE OSE confd source file]) +AC_ARG_VAR(erl_xcomp_ose_CRT0_LM, [OSE crt0 lm source file]) ]) @@ -1106,7 +1108,12 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) ;; ose_threads) - AC_DEFINE(ETHR_OSE_THREADS, 1, [Define if you have OSE style threads]) ETHR_THR_LIB_BASE_DIR=ose + AC_DEFINE(ETHR_OSE_THREADS, 1, + [Define if you have OSE style threads]) + ETHR_THR_LIB_BASE_DIR=ose + AC_CHECK_HEADER(ose_spi/ose_spi.h, + AC_DEFINE(HAVE_OSE_SPI, 1, + [Define if you have the "ose_spi/ose_spi.h" header file.])) ;; esac if test "x$THR_LIB_NAME" == "xpthread"; then diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index 9935b911f6..63deae76d5 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -690,6 +690,14 @@ $(OBJDIR)/%.o: $(TTF_DIR)/%.c $(OBJDIR)/%.o: sys/$(ERLANG_OSTYPE)/%.c $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ +ifeq ($(findstring ose,$(TARGET)),ose) +$(OBJDIR)/ose_confd.o: $(OSE_CONFD) + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + +$(OBJDIR)/crt0_lm.o: $(CRT0_LM) + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ +endif + $(OBJDIR)/%.o: sys/common/%.c $(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ @@ -815,8 +823,8 @@ OS_OBJS = \ $(OBJDIR)/gzio.o \ $(OBJDIR)/elib_memmove.o -OS_OBJS += $(OSEROOT)/src/ose_confd.o \ - $(OSEROOT)/src/crt0_lm.o +OS_OBJS += $(OBJDIR)/ose_confd.o \ + $(OBJDIR)/crt0_lm.o OS_OBJS += $(OBJDIR)/sys_float.o \ $(OBJDIR)/sys_time.o diff --git a/erts/emulator/drivers/ose/ose_signal_drv.c b/erts/emulator/drivers/ose/ose_signal_drv.c index acf09f748e..c1d861cc5a 100644 --- a/erts/emulator/drivers/ose/ose_signal_drv.c +++ b/erts/emulator/drivers/ose/ose_signal_drv.c @@ -28,7 +28,10 @@ #include "sys.h" #include "erl_driver.h" #include "ose.h" + +#ifdef HAVE_OSE_SPI_H #include "ose_spi/ose_spi.h" +#endif #define DEBUG_ATTACH 0 #define DEBUG_HUNT 0 @@ -819,6 +822,7 @@ static ErlDrvSSizeT control(ErlDrvData driver_data, unsigned int cmd, return sizeof(PROCESS); } +#ifdef HAVE_OSE_SPI_H case GET_NAME: { const PROCESS spid = get_u32(buf); @@ -839,6 +843,7 @@ static ErlDrvSSizeT control(ErlDrvData driver_data, unsigned int cmd, return n; } +#endif default: { /* Unknown command */ diff --git a/erts/emulator/sys/ose/erl_main.c b/erts/emulator/sys/ose/erl_main.c index 322058c87b..a17fc7eabc 100644 --- a/erts/emulator/sys/ose/erl_main.c +++ b/erts/emulator/sys/ose/erl_main.c @@ -17,10 +17,25 @@ * %CopyrightEnd% */ +#include <stdlib.h> + int main(int argc, char **argv) { + /* When starting using pm_create -c ARGV="-- -root ..", argv[0] is the first + part of ARGV and not the name of the executable. So we shuffle some + pointers here to make erl_start happy. */ + if (argv[0][0] == '-') { + int i; + char **tmp_argv = malloc(sizeof(char*)*(argc+1)); + for (i = 0; i < argc; i++) + tmp_argv[i+1] = argv[i]; + tmp_argv = "beam"; + erl_start(argc,tmp_argv); + free(tmp_argv); + } else { erl_start(argc,argv); + } stop(current_process()); diff --git a/erts/emulator/sys/ose/sys.c b/erts/emulator/sys/ose/sys.c index a8eb0b93b4..a8a99ceca6 100644 --- a/erts/emulator/sys/ose/sys.c +++ b/erts/emulator/sys/ose/sys.c @@ -852,6 +852,11 @@ OS_PROCESS(fd_reader_process) { } #endif + if (fd == 0) { + FILE *ffd = stdin; + (void)stdin; + } + sigsel[1] = ERTS_SIGNAL_FD_DRV_ASYNC; read_buf = (byte *) erts_alloc(ERTS_ALC_T_SYS_READ_BUF, @@ -909,8 +914,10 @@ OS_PROCESS(fd_writer_process) { /* Why do I need these?!? */ if (fd == 1) { FILE* ffd = stdout; + (void)stdout; } else if (fd == 2) { FILE* ffd = stderr; + (void)stderr; } while (1) { diff --git a/erts/epmd/src/Makefile.in b/erts/epmd/src/Makefile.in index faf0101ad7..2ea8630491 100644 --- a/erts/epmd/src/Makefile.in +++ b/erts/epmd/src/Makefile.in @@ -135,9 +135,9 @@ clean: rm -f *~ core ifeq ($(findstring ose,$(TARGET)),ose) -$(OBJDIR)/ose_confd.o: $(OSEROOT)/src/ose_confd.c +$(OBJDIR)/ose_confd.o: $(OSE_CONFD) $(V_CC) $(CFLAGS) -o $@ -c $< -$(OBJDIR)/crt0_lm.o: $(OSEROOT)/src/crt0_lm.c +$(OBJDIR)/crt0_lm.o: $(CRT0_LM) $(V_CC) $(CFLAGS) -o $@ -c $< OSE_LM_OBJS += $(OBJDIR)/ose_confd.o $(OBJDIR)/crt0_lm.o endif diff --git a/erts/lib_src/ose/ethread.c b/erts/lib_src/ose/ethread.c index 7046cc8d03..01d58e65b2 100644 --- a/erts/lib_src/ose/ethread.c +++ b/erts/lib_src/ose/ethread.c @@ -125,23 +125,30 @@ static OS_PROCESS(thr_wrapper) void *arg; ethr_ts_event *tsep = NULL; +#ifdef DEBUG { PROCESS pid = current_process(); - const char *execMode = get_pid_info(pid, OSE_PI_SUPERVISOR) - ? "Supervisor" - : "User"; + const char *execMode; + PROCESS bid = get_bid(pid); /* In the call below, 16 is a secret number provided by frbr that makes * the function return current domain. */ OSADDRESS domain = get_pid_info(current_process(), 16); -#ifdef DEBUG +#ifdef HAVE_OSE_SPI_H + execMode = get_pid_info(pid, OSE_PI_SUPERVISOR) + ? "Supervisor" + : "User"; +#else + execMode = "unknown"; +#endif + fprintf(stderr,"[0x%x] New process. Bid:0x%x, domain:%d, exec mode:%s\n", current_process(), bid, domain, execMode); -#endif } +#endif { SIGSELECT sigsel[] = {1,ETHREADWRAPDATASIG}; diff --git a/lib/erl_interface/aclocal.m4 b/lib/erl_interface/aclocal.m4 index 4a3407e0eb..09d0f0194c 100644 --- a/lib/erl_interface/aclocal.m4 +++ b/lib/erl_interface/aclocal.m4 @@ -84,6 +84,8 @@ AC_ARG_VAR(erl_xcomp_ose_LM_SET_CONF, [Sets the configuration for an OSE load mo AC_ARG_VAR(erl_xcomp_ose_LM_ELF_SIZE, [Prints the section size information for an OSE load module (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_LCF, [OSE load module linker configuration file (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_CONF, [OSE load module default configuration file (only used when cross compiling for OSE)]) +AC_ARG_VAR(erl_xcomp_ose_CONFD, [OSE OSE confd source file]) +AC_ARG_VAR(erl_xcomp_ose_CRT0_LM, [OSE crt0 lm source file]) ]) @@ -1106,7 +1108,12 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) ;; ose_threads) - AC_DEFINE(ETHR_OSE_THREADS, 1, [Define if you have OSE style threads]) ETHR_THR_LIB_BASE_DIR=ose + AC_DEFINE(ETHR_OSE_THREADS, 1, + [Define if you have OSE style threads]) + ETHR_THR_LIB_BASE_DIR=ose + AC_CHECK_HEADER(ose_spi/ose_spi.h, + AC_DEFINE(HAVE_OSE_SPI, 1, + [Define if you have the "ose_spi/ose_spi.h" header file.])) ;; esac if test "x$THR_LIB_NAME" == "xpthread"; then diff --git a/lib/megaco/aclocal.m4 b/lib/megaco/aclocal.m4 index 4a3407e0eb..09d0f0194c 100644 --- a/lib/megaco/aclocal.m4 +++ b/lib/megaco/aclocal.m4 @@ -84,6 +84,8 @@ AC_ARG_VAR(erl_xcomp_ose_LM_SET_CONF, [Sets the configuration for an OSE load mo AC_ARG_VAR(erl_xcomp_ose_LM_ELF_SIZE, [Prints the section size information for an OSE load module (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_LCF, [OSE load module linker configuration file (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_CONF, [OSE load module default configuration file (only used when cross compiling for OSE)]) +AC_ARG_VAR(erl_xcomp_ose_CONFD, [OSE OSE confd source file]) +AC_ARG_VAR(erl_xcomp_ose_CRT0_LM, [OSE crt0 lm source file]) ]) @@ -1106,7 +1108,12 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) ;; ose_threads) - AC_DEFINE(ETHR_OSE_THREADS, 1, [Define if you have OSE style threads]) ETHR_THR_LIB_BASE_DIR=ose + AC_DEFINE(ETHR_OSE_THREADS, 1, + [Define if you have OSE style threads]) + ETHR_THR_LIB_BASE_DIR=ose + AC_CHECK_HEADER(ose_spi/ose_spi.h, + AC_DEFINE(HAVE_OSE_SPI, 1, + [Define if you have the "ose_spi/ose_spi.h" header file.])) ;; esac if test "x$THR_LIB_NAME" == "xpthread"; then diff --git a/lib/odbc/aclocal.m4 b/lib/odbc/aclocal.m4 index 4a3407e0eb..09d0f0194c 100644 --- a/lib/odbc/aclocal.m4 +++ b/lib/odbc/aclocal.m4 @@ -84,6 +84,8 @@ AC_ARG_VAR(erl_xcomp_ose_LM_SET_CONF, [Sets the configuration for an OSE load mo AC_ARG_VAR(erl_xcomp_ose_LM_ELF_SIZE, [Prints the section size information for an OSE load module (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_LCF, [OSE load module linker configuration file (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_CONF, [OSE load module default configuration file (only used when cross compiling for OSE)]) +AC_ARG_VAR(erl_xcomp_ose_CONFD, [OSE OSE confd source file]) +AC_ARG_VAR(erl_xcomp_ose_CRT0_LM, [OSE crt0 lm source file]) ]) @@ -1106,7 +1108,12 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) ;; ose_threads) - AC_DEFINE(ETHR_OSE_THREADS, 1, [Define if you have OSE style threads]) ETHR_THR_LIB_BASE_DIR=ose + AC_DEFINE(ETHR_OSE_THREADS, 1, + [Define if you have OSE style threads]) + ETHR_THR_LIB_BASE_DIR=ose + AC_CHECK_HEADER(ose_spi/ose_spi.h, + AC_DEFINE(HAVE_OSE_SPI, 1, + [Define if you have the "ose_spi/ose_spi.h" header file.])) ;; esac if test "x$THR_LIB_NAME" == "xpthread"; then diff --git a/lib/wx/aclocal.m4 b/lib/wx/aclocal.m4 index 4a3407e0eb..09d0f0194c 100644 --- a/lib/wx/aclocal.m4 +++ b/lib/wx/aclocal.m4 @@ -84,6 +84,8 @@ AC_ARG_VAR(erl_xcomp_ose_LM_SET_CONF, [Sets the configuration for an OSE load mo AC_ARG_VAR(erl_xcomp_ose_LM_ELF_SIZE, [Prints the section size information for an OSE load module (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_LCF, [OSE load module linker configuration file (only used when cross compiling for OSE)]) AC_ARG_VAR(erl_xcomp_ose_LM_CONF, [OSE load module default configuration file (only used when cross compiling for OSE)]) +AC_ARG_VAR(erl_xcomp_ose_CONFD, [OSE OSE confd source file]) +AC_ARG_VAR(erl_xcomp_ose_CRT0_LM, [OSE crt0 lm source file]) ]) @@ -1106,7 +1108,12 @@ case "$THR_LIB_NAME" in AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) ;; ose_threads) - AC_DEFINE(ETHR_OSE_THREADS, 1, [Define if you have OSE style threads]) ETHR_THR_LIB_BASE_DIR=ose + AC_DEFINE(ETHR_OSE_THREADS, 1, + [Define if you have OSE style threads]) + ETHR_THR_LIB_BASE_DIR=ose + AC_CHECK_HEADER(ose_spi/ose_spi.h, + AC_DEFINE(HAVE_OSE_SPI, 1, + [Define if you have the "ose_spi/ose_spi.h" header file.])) ;; esac if test "x$THR_LIB_NAME" == "xpthread"; then diff --git a/make/ose_lm.mk.in b/make/ose_lm.mk.in index 38d40c4301..2e659ada1a 100644 --- a/make/ose_lm.mk.in +++ b/make/ose_lm.mk.in @@ -42,6 +42,8 @@ STRIP = @erl_xcomp_ose_STRIP@ LM_POST_LINK = @erl_xcomp_ose_LM_POST_LINK@ LM_SET_CONF = @erl_xcomp_ose_LM_SET_CONF@ LM_ELF_SIZE = @erl_xcomp_ose_LM_ELF_SIZE@ +OSE_CONFD = @erl_xcomp_ose_CONFD@ +CRT0_LM = @erl_xcomp_ose_CRT0_LM@ endif define build-ose-load-module diff --git a/xcomp/erl-xcomp-powerpc-ose5.conf b/xcomp/erl-xcomp-powerpc-ose5.conf index be2944618c..03e3b81e64 100644 --- a/xcomp/erl-xcomp-powerpc-ose5.conf +++ b/xcomp/erl-xcomp-powerpc-ose5.conf @@ -302,4 +302,11 @@ erl_xcomp_ose_LM_LCF="${ERL_TOP}/erts/emulator/sys/ose/gcc_${GCCVERSION}_lm_ppc. # * `erl_xcomp_ose_LM_CONF` - OSE load module default configuration file erl_xcomp_ose_LM_CONF="${ERL_TOP}/erts/emulator/sys/ose/default.lmconf" +# * `erl_xcomp_ose_CONFD` - OSE confd source file +erl_xcomp_ose_CONFD="${OSEROOT}/src/ose_confd.c" + +# * `erl_xcomp_ose_CRT0_LM` - OSE crt0 lm source file +erl_xcomp_ose_CRT0_LM="${OSEROOT}/src/crt0_lm.c" + + ## ----------------------------------------------------------------------------- diff --git a/xcomp/erl-xcomp-vars.sh b/xcomp/erl-xcomp-vars.sh index 1bcbe9aca9..c5e245b4b6 100644 --- a/xcomp/erl-xcomp-vars.sh +++ b/xcomp/erl-xcomp-vars.sh @@ -26,4 +26,4 @@ # and precious variables in $ERL_TOP/erts/aclocal.m4. # -erl_xcomp_vars="erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers erl_xcomp_posix_memalign erl_xcomp_ose_ldflags_pass1 erl_xcomp_ose_ldflags_pass2 erl_xcomp_ose_OSEROOT erl_xcomp_ose_STRIP erl_xcomp_ose_LM_POST_LINK erl_xcomp_ose_LM_SET_CONF erl_xcomp_ose_LM_GET_CONF erl_xcomp_ose_LM_ELF_SIZE erl_xcomp_ose_LM_LCF erl_xcomp_ose_LM_CONF" +erl_xcomp_vars="erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers erl_xcomp_posix_memalign erl_xcomp_ose_ldflags_pass1 erl_xcomp_ose_ldflags_pass2 erl_xcomp_ose_OSEROOT erl_xcomp_ose_STRIP erl_xcomp_ose_LM_POST_LINK erl_xcomp_ose_LM_SET_CONF erl_xcomp_ose_LM_GET_CONF erl_xcomp_ose_LM_ELF_SIZE erl_xcomp_ose_LM_LCF erl_xcomp_ose_LM_CONF erl_xcomp_ose_CONFD erl_xcomp_ose_CRT0_LM" |