aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/Makefile.in15
-rw-r--r--erts/emulator/beam/bif.c9
-rw-r--r--erts/emulator/beam/erl_binary.h14
-rw-r--r--erts/emulator/beam/erl_port_task.c12
-rw-r--r--erts/emulator/beam/erl_term.h108
-rw-r--r--erts/emulator/beam/global.h65
-rw-r--r--erts/emulator/beam/utils.c8
-rw-r--r--erts/emulator/drivers/unix/ttsl_drv.c17
-rw-r--r--erts/emulator/hipe/hipe_amd64_asm.m433
-rw-r--r--erts/emulator/hipe/hipe_amd64_bifs.m4226
-rw-r--r--erts/emulator/hipe/hipe_amd64_glue.S116
-rw-r--r--erts/emulator/sys/common/erl_poll.c17
-rw-r--r--erts/emulator/sys/unix/sys.c17
-rw-r--r--erts/emulator/sys/unix/sys_float.c13
-rw-r--r--erts/emulator/zlib/Makefile.in26
15 files changed, 388 insertions, 308 deletions
diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in
index bc846d1e3d..2fe12be43e 100644
--- a/erts/emulator/Makefile.in
+++ b/erts/emulator/Makefile.in
@@ -167,6 +167,9 @@ ifeq ($(OPSYS),linux)
ppcBEAMLDFLAGS=-Wl,-m,elf32ppc
ppc64BEAMLDFLAGS=-Wl,-m,elf64ppc,-T,hipe/elf64ppc.x
endif
+ifeq ($(OPSYS),darwin)
+amd64BEAMLDFLAGS=-pagezero_size 0x10000000
+endif
HIPEBEAMLDFLAGS=$($(ARCH)BEAMLDFLAGS)
endif
@@ -606,7 +609,7 @@ endif
ifneq ($(filter tile-%,$(TARGET)),)
$(OBJDIR)/beam_emu.o: beam/beam_emu.c
- $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \
+ $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \
-OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off \
$(INCLUDES) -c $< -o $@
endif
@@ -1086,8 +1089,16 @@ DEP_FLAGS=-MM $(subst -O2,,$(CFLAGS)) $(INCLUDES) -I../etc/win32 -Idrivers/comm
# SYS_SRC=$(subst sys/common/erl_poll.c,,$(ALL_SYS_SRC))
else # !win32
+
+ifeq ($(findstring tile,$(TARGET)),tile)
+# tile-gcc doesn't like -MG
+MG_FLAG=
+else
+MG_FLAG=-MG
+endif
+
DEP_CC=$(CC)
-DEP_FLAGS=-MM -MG $(CFLAGS) $(INCLUDES) -Idrivers/common
+DEP_FLAGS=-MM $(MG_FLAG) $(CFLAGS) $(INCLUDES) -Idrivers/common
SYS_SRC=$(ALL_SYS_SRC)
endif
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 9c8c0df9f0..1b670585a7 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -4143,6 +4143,7 @@ BIF_RETTYPE blocking_read_file_1(BIF_ALIST_1)
FILE *file;
struct stat file_info;
char *filename = NULL;
+ size_t size;
i = list_length(BIF_ARG_1);
if (i < 0) {
@@ -4170,9 +4171,13 @@ BIF_RETTYPE blocking_read_file_1(BIF_ALIST_1)
fclose(file);
BIF_RET(TUPLE2(hp, am_error, am_allocator));
}
- fread(buff, 1, buff_size, file);
+ size = fread(buff, 1, buff_size, file);
fclose(file);
- bin = new_binary(BIF_P, buff, buff_size);
+ if (size < 0)
+ size = 0;
+ else if (size > buff_size)
+ size = (size_t) buff_size;
+ bin = new_binary(BIF_P, buff, (int) size);
erts_free(ERTS_ALC_T_TMP, (void *) buff);
BIF_RET(TUPLE2(hp, am_ok, bin));
diff --git a/erts/emulator/beam/erl_binary.h b/erts/emulator/beam/erl_binary.h
index dc5539faad..f8ecdde997 100644
--- a/erts/emulator/beam/erl_binary.h
+++ b/erts/emulator/beam/erl_binary.h
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2000-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2000-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -265,13 +265,13 @@ erts_bin_free(Binary *bp)
ERTS_GLB_INLINE Binary *
erts_create_magic_binary(Uint size, void (*destructor)(Binary *))
{
- Uint bsize = sizeof(Binary) - 1 + sizeof(ErtsBinaryMagicPart) - 1 + size;
+ Uint bsize = ERTS_MAGIC_BIN_SIZE(size);
Binary* bptr = erts_alloc_fnf(ERTS_ALC_T_BINARY, bsize);
if (!bptr)
erts_alloc_n_enomem(ERTS_ALC_T2N(ERTS_ALC_T_BINARY), bsize);
ERTS_CHK_BIN_ALIGNMENT(bptr);
bptr->flags = BIN_FLAG_MAGIC;
- bptr->orig_size = sizeof(ErtsBinaryMagicPart) - 1 + size;
+ bptr->orig_size = ERTS_MAGIC_BIN_ORIG_SIZE(size);
erts_refc_init(&bptr->refc, 0);
ERTS_MAGIC_BIN_DESTRUCTOR(bptr) = destructor;
return bptr;
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 3cb5a966ac..0b6bb0d8e9 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -575,7 +575,7 @@ erts_port_task_schedule(Eterm id,
}
#endif
- ASSERT(!(runq->flags & ERTS_RUNQ_FLG_SUSPENDED));
+ ASSERT(!enq_port || !(runq->flags & ERTS_RUNQ_FLG_SUSPENDED));
ASSERT(pp->sched.taskq);
ASSERT(ptp);
@@ -601,6 +601,15 @@ erts_port_task_schedule(Eterm id,
break;
}
+#ifndef ERTS_SMP
+ /*
+ * When (!enq_port && !pp->sched.exe_taskq) is true in the smp case,
+ * the port might not be in the run queue. If this is the case, another
+ * thread is in the process of enqueueing the port. This very seldom
+ * occur, but do occur and is a valid scenario. Debug info showing this
+ * enqueue in progress must be introduced before we can enable (modified
+ * versions of these) assertions in the smp case again.
+ */
#if defined(HARD_DEBUG)
if (pp->sched.exe_taskq || enq_port)
ERTS_PT_CHK_NOT_IN_PORTQ(runq, pp);
@@ -612,6 +621,7 @@ erts_port_task_schedule(Eterm id,
ASSERT(pp->sched.prev || runq->ports.start == pp);
}
#endif
+#endif
if (!enq_port) {
ERTS_PT_CHK_PRES_PORTQ(runq, pp);
diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h
index b0a57a3ebe..a6596558fa 100644
--- a/erts/emulator/beam/erl_term.h
+++ b/erts/emulator/beam/erl_term.h
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2000-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2000-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -38,7 +38,7 @@ struct erl_node_; /* Declared in erl_node_tables.h */
#endif
#if ET_DEBUG
-#define _ET_DECLARE_CHECKED(TF,F,TX) extern TF checked_##F(TX,const char*,unsigned)
+#define _ET_DECLARE_CHECKED(TF,F,TX) extern TF checked_##F(TX,const char*,unsigned);
#define _ET_APPLY(F,X) checked_##F(X,__FILE__,__LINE__)
#else
#define _ET_DECLARE_CHECKED(TF,F,TX)
@@ -160,27 +160,27 @@ struct erl_node_; /* Declared in erl_node_tables.h */
/* boxed object access methods */
#define _is_aligned(x) (((Uint)(x) & 0x3) == 0)
#define _unchecked_make_boxed(x) ((Uint)(x) + TAG_PRIMARY_BOXED)
-_ET_DECLARE_CHECKED(Eterm,make_boxed,Eterm*);
+_ET_DECLARE_CHECKED(Eterm,make_boxed,Eterm*)
#define make_boxed(x) _ET_APPLY(make_boxed,(x))
#if 1
#define _is_not_boxed(x) ((x) & (_TAG_PRIMARY_MASK-TAG_PRIMARY_BOXED))
#define _unchecked_is_boxed(x) (!_is_not_boxed((x)))
-_ET_DECLARE_CHECKED(int,is_boxed,Eterm);
+_ET_DECLARE_CHECKED(int,is_boxed,Eterm)
#define is_boxed(x) _ET_APPLY(is_boxed,(x))
#else
#define is_boxed(x) (((x) & _TAG_PRIMARY_MASK) == TAG_PRIMARY_BOXED)
#endif
#define _unchecked_boxed_val(x) ((Eterm*)((x) - TAG_PRIMARY_BOXED))
-_ET_DECLARE_CHECKED(Eterm*,boxed_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,boxed_val,Eterm)
#define boxed_val(x) _ET_APPLY(boxed_val,(x))
/* cons cell ("list") access methods */
#define _unchecked_make_list(x) ((Uint)(x) + TAG_PRIMARY_LIST)
-_ET_DECLARE_CHECKED(Eterm,make_list,Eterm*);
+_ET_DECLARE_CHECKED(Eterm,make_list,Eterm*)
#define make_list(x) _ET_APPLY(make_list,(x))
#if 1
#define _unchecked_is_not_list(x) ((x) & (_TAG_PRIMARY_MASK-TAG_PRIMARY_LIST))
-_ET_DECLARE_CHECKED(int,is_not_list,Eterm);
+_ET_DECLARE_CHECKED(int,is_not_list,Eterm)
#define is_not_list(x) _ET_APPLY(is_not_list,(x))
#define is_list(x) (!is_not_list((x)))
#else
@@ -188,7 +188,7 @@ _ET_DECLARE_CHECKED(int,is_not_list,Eterm);
#define is_not_list(x) (!is_list((x)))
#endif
#define _unchecked_list_val(x) ((Eterm*)((x) - TAG_PRIMARY_LIST))
-_ET_DECLARE_CHECKED(Eterm*,list_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,list_val,Eterm)
#define list_val(x) _ET_APPLY(list_val,(x))
#define CONS(hp, car, cdr) \
@@ -221,10 +221,10 @@ _ET_DECLARE_CHECKED(Eterm*,list_val,Eterm);
#define is_not_valid_bit_size(x) (!is_valid_bit_size((x)))
#define MY_IS_SSMALL(x) (((Uint) (((x) >> (SMALL_BITS-1)) + 1)) < 2)
#define _unchecked_unsigned_val(x) ((x) >> _TAG_IMMED1_SIZE)
-_ET_DECLARE_CHECKED(Uint,unsigned_val,Eterm);
+_ET_DECLARE_CHECKED(Uint,unsigned_val,Eterm)
#define unsigned_val(x) _ET_APPLY(unsigned_val,(x))
#define _unchecked_signed_val(x) ((Sint)(x) >> _TAG_IMMED1_SIZE)
-_ET_DECLARE_CHECKED(Sint,signed_val,Eterm);
+_ET_DECLARE_CHECKED(Sint,signed_val,Eterm)
#define signed_val(x) _ET_APPLY(signed_val,(x))
#if _TAG_IMMED1_SMALL == 0x0F
@@ -247,14 +247,14 @@ _ET_DECLARE_CHECKED(Sint,signed_val,Eterm);
#define is_atom(x) (((x) & _TAG_IMMED2_MASK) == _TAG_IMMED2_ATOM)
#define is_not_atom(x) (!is_atom(x))
#define _unchecked_atom_val(x) ((x) >> _TAG_IMMED2_SIZE)
-_ET_DECLARE_CHECKED(Uint,atom_val,Eterm);
+_ET_DECLARE_CHECKED(Uint,atom_val,Eterm)
#define atom_val(x) _ET_APPLY(atom_val,(x))
/* header (arityval or thing) access methods */
#define _make_header(sz,tag) ((Uint)(((sz) << _HEADER_ARITY_OFFS) + (tag)))
#define is_header(x) (((x) & _TAG_PRIMARY_MASK) == TAG_PRIMARY_HEADER)
#define _unchecked_header_arity(x) ((x) >> _HEADER_ARITY_OFFS)
-_ET_DECLARE_CHECKED(Uint,header_arity,Eterm);
+_ET_DECLARE_CHECKED(Uint,header_arity,Eterm)
#define header_arity(x) _ET_APPLY(header_arity,(x))
/* arityval access methods */
@@ -262,16 +262,16 @@ _ET_DECLARE_CHECKED(Uint,header_arity,Eterm);
#define is_arity_value(x) (((x) & _TAG_HEADER_MASK) == _TAG_HEADER_ARITYVAL)
#define is_not_arity_value(x) (!is_arity_value((x)))
#define _unchecked_arityval(x) _unchecked_header_arity((x))
-_ET_DECLARE_CHECKED(Uint,arityval,Eterm);
+_ET_DECLARE_CHECKED(Uint,arityval,Eterm)
#define arityval(x) _ET_APPLY(arityval,(x))
/* thing access methods */
#define is_thing(x) (is_header((x)) && header_is_thing((x)))
#define _unchecked_thing_arityval(x) _unchecked_header_arity((x))
-_ET_DECLARE_CHECKED(Uint,thing_arityval,Eterm);
+_ET_DECLARE_CHECKED(Uint,thing_arityval,Eterm)
#define thing_arityval(x) _ET_APPLY(thing_arityval,(x))
#define _unchecked_thing_subtag(x) ((x) & _HEADER_SUBTAG_MASK)
-_ET_DECLARE_CHECKED(Uint,thing_subtag,Eterm);
+_ET_DECLARE_CHECKED(Uint,thing_subtag,Eterm)
#define thing_subtag(x) _ET_APPLY(thing_subtag,(x))
/*
@@ -301,7 +301,7 @@ _ET_DECLARE_CHECKED(Uint,thing_subtag,Eterm);
#define is_binary(x) (is_boxed((x)) && is_binary_header(*boxed_val((x))))
#define is_not_binary(x) (!is_binary((x)))
#define _unchecked_binary_val(x) _unchecked_boxed_val((x))
-_ET_DECLARE_CHECKED(Eterm*,binary_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,binary_val,Eterm)
#define binary_val(x) _ET_APPLY(binary_val,(x))
/* process binaries stuff (special case of binaries) */
@@ -318,7 +318,7 @@ _ET_DECLARE_CHECKED(Eterm*,binary_val,Eterm);
#define is_fun(x) (is_boxed((x)) && is_fun_header(*boxed_val((x))))
#define is_not_fun(x) (!is_fun((x)))
#define _unchecked_fun_val(x) _unchecked_boxed_val((x))
-_ET_DECLARE_CHECKED(Eterm*,fun_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,fun_val,Eterm)
#define fun_val(x) _ET_APPLY(fun_val,(x))
/* export access methods */
@@ -326,7 +326,7 @@ _ET_DECLARE_CHECKED(Eterm*,fun_val,Eterm);
#define is_export(x) (is_boxed((x)) && is_export_header(*boxed_val((x))))
#define is_not_export(x) (!is_export((x)))
#define _unchecked_export_val(x) _unchecked_boxed_val(x)
-_ET_DECLARE_CHECKED(Eterm*,export_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,export_val,Eterm)
#define export_val(x) _ET_APPLY(export_val,(x))
#define is_export_header(x) ((x) == HEADER_EXPORT)
#define HEADER_EXPORT _make_header(1,_TAG_HEADER_EXPORT)
@@ -336,20 +336,20 @@ _ET_DECLARE_CHECKED(Eterm*,export_val,Eterm);
#define make_neg_bignum_header(sz) _make_header((sz),_TAG_HEADER_NEG_BIG)
#define _is_bignum_header(x) (((x) & (_TAG_HEADER_MASK-_BIG_SIGN_BIT)) == _TAG_HEADER_POS_BIG)
#define _unchecked_bignum_header_is_neg(x) ((x) & _BIG_SIGN_BIT)
-_ET_DECLARE_CHECKED(int,bignum_header_is_neg,Eterm);
+_ET_DECLARE_CHECKED(int,bignum_header_is_neg,Eterm)
#define bignum_header_is_neg(x) _ET_APPLY(bignum_header_is_neg,(x))
#define _unchecked_bignum_header_neg(x) ((x) | _BIG_SIGN_BIT)
-_ET_DECLARE_CHECKED(Eterm,bignum_header_neg,Eterm);
+_ET_DECLARE_CHECKED(Eterm,bignum_header_neg,Eterm)
#define bignum_header_neg(x) _ET_APPLY(bignum_header_neg,(x))
#define _unchecked_bignum_header_arity(x) _unchecked_header_arity((x))
-_ET_DECLARE_CHECKED(Uint,bignum_header_arity,Eterm);
+_ET_DECLARE_CHECKED(Uint,bignum_header_arity,Eterm)
#define bignum_header_arity(x) _ET_APPLY(bignum_header_arity,(x))
#define BIG_ARITY_MAX ((1 << 19)-1)
#define make_big(x) make_boxed((x))
#define is_big(x) (is_boxed((x)) && _is_bignum_header(*boxed_val((x))))
#define is_not_big(x) (!is_big((x)))
#define _unchecked_big_val(x) _unchecked_boxed_val((x))
-_ET_DECLARE_CHECKED(Eterm*,big_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,big_val,Eterm)
#define big_val(x) _ET_APPLY(big_val,(x))
/* flonum ("float") access methods */
@@ -362,7 +362,7 @@ _ET_DECLARE_CHECKED(Eterm*,big_val,Eterm);
#define is_float(x) (is_boxed((x)) && *boxed_val((x)) == HEADER_FLONUM)
#define is_not_float(x) (!is_float(x))
#define _unchecked_float_val(x) _unchecked_boxed_val((x))
-_ET_DECLARE_CHECKED(Eterm*,float_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,float_val,Eterm)
#define float_val(x) _ET_APPLY(float_val,(x))
/* Float definition for byte and word access */
@@ -409,7 +409,7 @@ typedef union float_def
(is_boxed((x)) && *boxed_val((x)) == make_arityval((a)))
#define is_not_tuple_arity(x, a) (!is_tuple_arity((x),(a)))
#define _unchecked_tuple_val(x) _unchecked_boxed_val(x)
-_ET_DECLARE_CHECKED(Eterm*,tuple_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,tuple_val,Eterm)
#define tuple_val(x) _ET_APPLY(tuple_val,(x))
#define TUPLE0(t) \
@@ -548,11 +548,11 @@ _ET_DECLARE_CHECKED(Eterm*,tuple_val,Eterm);
#define is_not_internal_pid(x) (!is_internal_pid((x)))
#define _unchecked_internal_pid_data(x) _GET_PID_DATA((x))
-_ET_DECLARE_CHECKED(Uint,internal_pid_data,Eterm);
+_ET_DECLARE_CHECKED(Uint,internal_pid_data,Eterm)
#define internal_pid_data(x) _ET_APPLY(internal_pid_data,(x))
#define _unchecked_internal_pid_node(x) erts_this_node
-_ET_DECLARE_CHECKED(struct erl_node_*,internal_pid_node,Eterm);
+_ET_DECLARE_CHECKED(struct erl_node_*,internal_pid_node,Eterm)
#define internal_pid_node(x) _ET_APPLY(internal_pid_node,(x))
#define internal_pid_number(x) _GET_PID_NUM(internal_pid_data((x)))
@@ -604,13 +604,13 @@ _ET_DECLARE_CHECKED(struct erl_node_*,internal_pid_node,Eterm);
#define is_not_internal_port(x) (!is_internal_port(x))
#define _unchecked_internal_port_data(x) _GET_PORT_DATA((x))
-_ET_DECLARE_CHECKED(Uint,internal_port_data,Eterm);
+_ET_DECLARE_CHECKED(Uint,internal_port_data,Eterm)
#define internal_port_data(x) _ET_APPLY(internal_port_data,(x))
#define internal_port_number(x) _GET_PORT_NUM(internal_port_data((x)))
#define _unchecked_internal_port_node(x) erts_this_node
-_ET_DECLARE_CHECKED(struct erl_node_*,internal_port_node,Eterm);
+_ET_DECLARE_CHECKED(struct erl_node_*,internal_port_node,Eterm)
#define internal_port_node(x) _ET_APPLY(internal_port_node,(x))
#define internal_port_data_words(x) (1)
@@ -753,20 +753,20 @@ do { \
(!is_internal_ref((x)))
#define _unchecked_internal_ref_val(x) _unchecked_boxed_val((x))
-_ET_DECLARE_CHECKED(Eterm*,internal_ref_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,internal_ref_val,Eterm)
#define internal_ref_val(x) _ET_APPLY(internal_ref_val,(x))
#define _unchecked_internal_ref_data_words(x) \
(_unchecked_thing_arityval(*_unchecked_internal_ref_val(x)))
-_ET_DECLARE_CHECKED(Uint,internal_ref_data_words,Eterm);
+_ET_DECLARE_CHECKED(Uint,internal_ref_data_words,Eterm)
#define internal_ref_data_words(x) _ET_APPLY(internal_ref_data_words,(x))
#define _unchecked_internal_ref_data(x) (_unchecked_ref_thing_ptr(x)->data.ui32)
-_ET_DECLARE_CHECKED(Uint32*,internal_ref_data,Eterm);
+_ET_DECLARE_CHECKED(Uint32*,internal_ref_data,Eterm)
#define internal_ref_data(x) _ET_APPLY(internal_ref_data,(x))
#define _unchecked_internal_ref_node(x) erts_this_node
-_ET_DECLARE_CHECKED(struct erl_node_*,internal_ref_node,Eterm);
+_ET_DECLARE_CHECKED(struct erl_node_*,internal_ref_node,Eterm)
#define internal_ref_node(x) _ET_APPLY(internal_ref_node,(x))
/*
@@ -864,7 +864,7 @@ typedef struct external_thing_ {
#define make_external_ref make_external
#define _unchecked_external_val(x) _unchecked_boxed_val((x))
-_ET_DECLARE_CHECKED(Eterm*,external_val,Eterm);
+_ET_DECLARE_CHECKED(Eterm*,external_val,Eterm)
#define external_val(x) _ET_APPLY(external_val,(x))
#define external_thing_ptr(x) ((ExternalThing *) external_val((x)))
@@ -874,7 +874,7 @@ _ET_DECLARE_CHECKED(Eterm*,external_val,Eterm);
#define _unchecked_external_data_words(x) \
(_unchecked_thing_arityval(_unchecked_external_thing_ptr((x))->header) \
+ (1 - EXTERNAL_THING_HEAD_SIZE))
-_ET_DECLARE_CHECKED(Uint,external_data_words,Eterm);
+_ET_DECLARE_CHECKED(Uint,external_data_words,Eterm)
#define external_data_words(x) _ET_APPLY(external_data_words,(x))
#define _unchecked_external_data(x) (_unchecked_external_thing_ptr((x))->data.ui)
@@ -885,15 +885,15 @@ _ET_DECLARE_CHECKED(Uint,external_data_words,Eterm);
#define _unchecked_external_pid_data_words(x) \
_unchecked_external_data_words((x))
-_ET_DECLARE_CHECKED(Uint,external_pid_data_words,Eterm);
+_ET_DECLARE_CHECKED(Uint,external_pid_data_words,Eterm)
#define external_pid_data_words(x) _ET_APPLY(external_pid_data_words,(x))
#define _unchecked_external_pid_data(x) _unchecked_external_data((x))[0]
-_ET_DECLARE_CHECKED(Uint,external_pid_data,Eterm);
+_ET_DECLARE_CHECKED(Uint,external_pid_data,Eterm)
#define external_pid_data(x) _ET_APPLY(external_pid_data,(x))
#define _unchecked_external_pid_node(x) _unchecked_external_node((x))
-_ET_DECLARE_CHECKED(struct erl_node_*,external_pid_node,Eterm);
+_ET_DECLARE_CHECKED(struct erl_node_*,external_pid_node,Eterm)
#define external_pid_node(x) _ET_APPLY(external_pid_node,(x))
#define external_pid_number(x) _GET_PID_NUM(external_pid_data((x)))
@@ -901,30 +901,30 @@ _ET_DECLARE_CHECKED(struct erl_node_*,external_pid_node,Eterm);
#define _unchecked_external_port_data_words(x) \
_unchecked_external_data_words((x))
-_ET_DECLARE_CHECKED(Uint,external_port_data_words,Eterm);
+_ET_DECLARE_CHECKED(Uint,external_port_data_words,Eterm)
#define external_port_data_words(x) _ET_APPLY(external_port_data_words,(x))
#define _unchecked_external_port_data(x) _unchecked_external_data((x))[0]
-_ET_DECLARE_CHECKED(Uint,external_port_data,Eterm);
+_ET_DECLARE_CHECKED(Uint,external_port_data,Eterm)
#define external_port_data(x) _ET_APPLY(external_port_data,(x))
#define _unchecked_external_port_node(x) _unchecked_external_node((x))
-_ET_DECLARE_CHECKED(struct erl_node_*,external_port_node,Eterm);
+_ET_DECLARE_CHECKED(struct erl_node_*,external_port_node,Eterm)
#define external_port_node(x) _ET_APPLY(external_port_node,(x))
#define external_port_number(x) _GET_PORT_NUM(external_port_data((x)))
#define _unchecked_external_ref_data_words(x) \
_unchecked_external_data_words((x))
-_ET_DECLARE_CHECKED(Uint,external_ref_data_words,Eterm);
+_ET_DECLARE_CHECKED(Uint,external_ref_data_words,Eterm)
#define external_ref_data_words(x) _ET_APPLY(external_ref_data_words,(x))
#define _unchecked_external_ref_data(x) (_unchecked_external_thing_ptr((x))->data.ui32)
-_ET_DECLARE_CHECKED(Uint32*,external_ref_data,Eterm);
+_ET_DECLARE_CHECKED(Uint32*,external_ref_data,Eterm)
#define external_ref_data(x) _ET_APPLY(external_ref_data,(x))
#define _unchecked_external_ref_node(x) _unchecked_external_node((x))
-_ET_DECLARE_CHECKED(struct erl_node_*,external_ref_node,Eterm);
+_ET_DECLARE_CHECKED(struct erl_node_*,external_ref_node,Eterm)
#define external_ref_node(x) _ET_APPLY(external_ref_node,(x))
/* number tests */
@@ -945,21 +945,21 @@ _ET_DECLARE_CHECKED(struct erl_node_*,external_ref_node,Eterm);
#endif
#define _unchecked_make_cp(x) ((Eterm)(x))
-_ET_DECLARE_CHECKED(Eterm,make_cp,Uint*);
+_ET_DECLARE_CHECKED(Eterm,make_cp,Uint*)
#define make_cp(x) _ET_APPLY(make_cp,(x))
#define is_not_CP(x) ((x) & _CPMASK)
#define is_CP(x) (!is_not_CP(x))
#define _unchecked_cp_val(x) ((Uint*)(x))
-_ET_DECLARE_CHECKED(Uint*,cp_val,Eterm);
+_ET_DECLARE_CHECKED(Uint*,cp_val,Eterm)
#define cp_val(x) _ET_APPLY(cp_val,(x))
#define make_catch(x) (((x) << _TAG_IMMED2_SIZE) | _TAG_IMMED2_CATCH)
#define is_catch(x) (((x) & _TAG_IMMED2_MASK) == _TAG_IMMED2_CATCH)
#define is_not_catch(x) (!is_catch(x))
#define _unchecked_catch_val(x) ((x) >> _TAG_IMMED2_SIZE)
-_ET_DECLARE_CHECKED(Uint,catch_val,Eterm);
+_ET_DECLARE_CHECKED(Uint,catch_val,Eterm)
#define catch_val(x) _ET_APPLY(catch_val,(x))
#define make_blank(X) ((X) = NIL)
@@ -989,21 +989,21 @@ _ET_DECLARE_CHECKED(Uint,catch_val,Eterm);
#define _is_yreg(x) (beam_reg_tag(x) == Y_REG_DEF)
#define _unchecked_x_reg_offset(R) ((R) - X_REG_DEF)
-_ET_DECLARE_CHECKED(Uint,x_reg_offset,Uint);
+_ET_DECLARE_CHECKED(Uint,x_reg_offset,Uint)
#define x_reg_offset(R) _ET_APPLY(x_reg_offset,(R))
#define _unchecked_y_reg_offset(R) ((R) - Y_REG_DEF)
-_ET_DECLARE_CHECKED(Uint,y_reg_offset,Uint);
+_ET_DECLARE_CHECKED(Uint,y_reg_offset,Uint)
#define y_reg_offset(R) _ET_APPLY(y_reg_offset,(R))
#define reg_index(R) ((R) / sizeof(Eterm))
#define _unchecked_x_reg_index(R) ((R) >> 2)
-_ET_DECLARE_CHECKED(Uint,x_reg_index,Uint);
+_ET_DECLARE_CHECKED(Uint,x_reg_index,Uint)
#define x_reg_index(R) _ET_APPLY(x_reg_index,(R))
#define _unchecked_y_reg_index(R) ((R) >> 2)
-_ET_DECLARE_CHECKED(Uint,y_reg_index,Uint);
+_ET_DECLARE_CHECKED(Uint,y_reg_index,Uint)
#define y_reg_index(R) _ET_APPLY(y_reg_index,(R))
/*
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index df0ab40074..8def007c63 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -21,6 +21,7 @@
#define __GLOBAL_H__
#include "sys.h"
+#include <stddef.h> /* offsetof() */
#include "erl_alloc.h"
#include "erl_vm.h"
#include "erl_node_container_utils.h"
@@ -382,17 +383,42 @@ extern Eterm erts_ddll_monitor_driver(Process *p,
** and Binary, the macros below can convert one type to the other, as they both
** in reality are equal.
*/
-typedef struct binary {
- Uint flags;
- erts_refc_t refc;
+
#ifdef ARCH_32
- Uint32 align__; /* *DO NOT USE* only for alignment. */
+ /* *DO NOT USE* only for alignment. */
+#define ERTS_BINARY_STRUCT_ALIGNMENT Uint32 align__;
+#else
+#define ERTS_BINARY_STRUCT_ALIGNMENT
#endif
- /* Add fields BEFORE this, otherwise the drivers crash */
+
+/* Add fields in ERTS_INTERNAL_BINARY_FIELDS, otherwise the drivers crash */
+#define ERTS_INTERNAL_BINARY_FIELDS \
+ Uint flags; \
+ erts_refc_t refc; \
+ ERTS_BINARY_STRUCT_ALIGNMENT
+
+typedef struct binary {
+ ERTS_INTERNAL_BINARY_FIELDS
long orig_size;
char orig_bytes[1]; /* to be continued */
} Binary;
+typedef struct {
+ ERTS_INTERNAL_BINARY_FIELDS
+ long orig_size;
+ void (*destructor)(Binary *);
+ char magic_bin_data[1];
+} ErtsMagicBinary;
+
+typedef union {
+ Binary binary;
+ ErtsMagicBinary magic_binary;
+ struct {
+ ERTS_INTERNAL_BINARY_FIELDS
+ ErlDrvBinary binary;
+ } driver;
+} ErtsBinary;
+
/*
* 'Binary' alignment:
* Address of orig_bytes[0] of a Binary should always be 8-byte aligned.
@@ -400,25 +426,21 @@ typedef struct binary {
* 32-bits architectures and 8 bytes on 64-bits architectures.
*/
-/*
- * "magic" binary.
- */
-typedef struct {
- void (*destructor)(Binary *);
- char magic_bin_data[1];
-} ErtsBinaryMagicPart;
-
#define ERTS_MAGIC_BIN_DESTRUCTOR(BP) \
- (((ErtsBinaryMagicPart *) (BP)->orig_bytes)->destructor)
+ ((ErtsBinary *) (BP))->magic_binary.destructor
#define ERTS_MAGIC_BIN_DATA(BP) \
- ((void *) (((ErtsBinaryMagicPart *) (BP)->orig_bytes)->magic_bin_data))
+ ((void *) ((ErtsBinary *) (BP))->magic_binary.magic_bin_data)
#define ERTS_MAGIC_BIN_DATA_SIZE(BP) \
- ((BP)->orig_size - (sizeof(ErtsBinaryMagicPart) - 1))
+ ((BP)->orig_size - sizeof(void (*)(Binary *)))
+#define ERTS_MAGIC_BIN_ORIG_SIZE(Sz) \
+ (sizeof(void (*)(Binary *)) + (Sz))
+#define ERTS_MAGIC_BIN_SIZE(Sz) \
+ (sizeof(ErtsMagicBinary) - 1 + (Sz))
-#define Binary2ErlDrvBinary(B) ((ErlDrvBinary *) (&((B)->orig_size)))
+#define Binary2ErlDrvBinary(B) (&((ErtsBinary *) (B))->driver.binary)
#define ErlDrvBinary2Binary(D) ((Binary *) \
- (((char *) (D)) - \
- ((char *) &(((Binary *) 0)->orig_size))))
+ (((char *) (D)) \
+ - offsetof(ErtsBinary, driver.binary)))
/* A "magic" binary flag */
#define BIN_FLAG_MAGIC 1
@@ -1406,6 +1428,11 @@ void p_slpq(_VOID_);
/* utils.c */
+/*
+ * To be used to silence unused result warnings, but do not abuse it.
+ */
+void erts_silence_warn_unused_result(long unused);
+
void erts_cleanup_offheap(ErlOffHeap *offheap);
void erts_cleanup_externals(ExternalThing *);
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index c162395159..687e6fa67b 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -3982,6 +3982,14 @@ erts_write_env(char *key, char *value)
return res;
}
+/*
+ * To be used to silence unused result warnings, but do not abuse it.
+ */
+void erts_silence_warn_unused_result(long unused)
+{
+
+}
+
#ifdef DEBUG
/*
* Handy functions when using a debugger - don't use in the code!
diff --git a/erts/emulator/drivers/unix/ttsl_drv.c b/erts/emulator/drivers/unix/ttsl_drv.c
index 4c2514669b..4cd54c073f 100644
--- a/erts/emulator/drivers/unix/ttsl_drv.c
+++ b/erts/emulator/drivers/unix/ttsl_drv.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 1996-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 1996-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
/*
@@ -142,7 +142,9 @@ static int tty_init(int,int,int,int);
static int tty_set(int);
static int tty_reset(int);
static int ttysl_control(ErlDrvData, unsigned int, char *, int, char **, int);
+#ifdef ERTS_NOT_USED
static RETSIGTYPE suspend(int);
+#endif
static RETSIGTYPE cont(int);
static RETSIGTYPE winch(int);
@@ -1265,6 +1267,9 @@ static int tty_reset(int fd) /* of terminal device */
* to the orignal settings
*/
+#ifdef ERTS_NOT_USED
+/* XXX: A mistake that it isn't used, or should it be removed? */
+
static RETSIGTYPE suspend(int sig)
{
if (tty_reset(ttysl_fd) < 0) {
@@ -1284,6 +1289,8 @@ static RETSIGTYPE suspend(int sig)
}
}
+#endif
+
static RETSIGTYPE cont(int sig)
{
if (tty_set(ttysl_fd) < 0) {
diff --git a/erts/emulator/hipe/hipe_amd64_asm.m4 b/erts/emulator/hipe/hipe_amd64_asm.m4
index 9ce9b4fc5b..7f563c35d8 100644
--- a/erts/emulator/hipe/hipe_amd64_asm.m4
+++ b/erts/emulator/hipe/hipe_amd64_asm.m4
@@ -1,20 +1,20 @@
changecom(`/*', `*/')dnl
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2004-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2004-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
/*
@@ -37,6 +37,29 @@ define(SIMULATE_NSP,0)dnl change to 1 to simulate call/ret insns
`#define LEAF_WORDS 'LEAF_WORDS
/*
+ * Workarounds for Darwin.
+ */
+ifelse(OPSYS,darwin,``
+/* Darwin */
+#define TEXT .text
+#define JOIN(X,Y) X##Y
+#define CSYM(NAME) JOIN(_,NAME)
+#define ASYM(NAME) CSYM(NAME)
+#define GLOBAL(NAME) .globl NAME
+#define SET_SIZE(NAME) /*empty*/
+#define TYPE_FUNCTION(NAME) /*empty*/
+'',``
+/* Not Darwin */
+#define TEXT .section ".text"
+#define CSYM(NAME) NAME
+#define ASYM(NAME) NAME
+#define GLOBAL(NAME) .global NAME
+#define SET_SIZE(NAME) .size NAME,.-NAME
+#define TYPE_FUNCTION(NAME) .type NAME,@function
+'')dnl
+
+
+/*
* Reserved registers.
*/
`#define P %rbp'
diff --git a/erts/emulator/hipe/hipe_amd64_bifs.m4 b/erts/emulator/hipe/hipe_amd64_bifs.m4
index 66fd167f47..f7c9604e2b 100644
--- a/erts/emulator/hipe/hipe_amd64_bifs.m4
+++ b/erts/emulator/hipe/hipe_amd64_bifs.m4
@@ -1,20 +1,20 @@
changecom(`/*', `*/')dnl
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2004-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2004-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
/*
@@ -46,17 +46,17 @@ define(standard_bif_interface_1,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,1,0)
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call $2
+ call CSYM($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -65,18 +65,18 @@ $1:
jz nbif_1_simple_exception
NBIF_RET(1)
HANDLE_GOT_MBUF(1)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(standard_bif_interface_2,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,2,0)
@@ -84,7 +84,7 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call $2
+ call CSYM($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -93,18 +93,18 @@ $1:
jz nbif_2_simple_exception
NBIF_RET(2)
HANDLE_GOT_MBUF(2)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(standard_bif_interface_3,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,3,0)
@@ -113,7 +113,7 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call $2
+ call CSYM($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -122,8 +122,8 @@ $1:
jz nbif_3_simple_exception
NBIF_RET(3)
HANDLE_GOT_MBUF(3)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
/*
@@ -136,16 +136,16 @@ define(fail_bif_interface_0,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call $2
+ call CSYM($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -154,8 +154,8 @@ $1:
jz nbif_0_simple_exception
NBIF_RET(0)
HANDLE_GOT_MBUF(0)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
/*
@@ -172,59 +172,59 @@ define(nofail_primop_interface_0,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call $2
+ call CSYM($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
/* return */
NBIF_RET(0)
HANDLE_GOT_MBUF(0)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(nofail_primop_interface_1,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,1,0)
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call $2
+ call CSYM($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
/* return */
NBIF_RET(1)
HANDLE_GOT_MBUF(1)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(nofail_primop_interface_2,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,2,0)
@@ -232,25 +232,25 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call $2
+ call CSYM($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
/* return */
NBIF_RET(2)
HANDLE_GOT_MBUF(2)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(nofail_primop_interface_3,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,3,0)
@@ -259,15 +259,15 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call $2
+ call CSYM($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
/* return */
NBIF_RET(3)
HANDLE_GOT_MBUF(3)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
/*
@@ -285,55 +285,55 @@ define(nocons_nofail_primop_interface_0,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(0)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(nocons_nofail_primop_interface_1,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,1,0)
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(1)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(nocons_nofail_primop_interface_2,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,2,0)
@@ -341,23 +341,23 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(2)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(nocons_nofail_primop_interface_3,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,3,0)
@@ -366,23 +366,23 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(3)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(nocons_nofail_primop_interface_5,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
movq P, %rdi
NBIF_ARG(%rsi,5,0)
@@ -393,13 +393,13 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(5)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
/*
@@ -417,74 +417,74 @@ define(noproc_primop_interface_0,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(0)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(noproc_primop_interface_1,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
NBIF_ARG(%rdi,1,0)
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(1)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(noproc_primop_interface_2,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
NBIF_ARG(%rdi,2,0)
NBIF_ARG(%rsi,2,1)
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(2)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(noproc_primop_interface_3,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
NBIF_ARG(%rdi,3,0)
NBIF_ARG(%rsi,3,1)
@@ -492,23 +492,23 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(3)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
define(noproc_primop_interface_5,
`
#ifndef HAVE_$1
#`define' HAVE_$1
- .section ".text"
+ TEXT
.align 4
- .global $1
-$1:
+ GLOBAL(ASYM($1))
+ASYM($1):
/* set up the parameters */
NBIF_ARG(%rdi,5,0)
NBIF_ARG(%rsi,5,1)
@@ -518,13 +518,13 @@ $1:
/* make the call on the C stack */
SWITCH_ERLANG_TO_C_QUICK
- call $2
+ call CSYM($2)
SWITCH_C_TO_ERLANG_QUICK
/* return */
NBIF_RET(5)
- .size $1,.-$1
- .type $1,@function
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
#endif')
/*
diff --git a/erts/emulator/hipe/hipe_amd64_glue.S b/erts/emulator/hipe/hipe_amd64_glue.S
index 872c5dc9e3..83b7b0397b 100644
--- a/erts/emulator/hipe/hipe_amd64_glue.S
+++ b/erts/emulator/hipe/hipe_amd64_glue.S
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2004-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2004-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
/*
@@ -56,16 +56,16 @@
/* switch to native stack */ \
SWITCH_C_TO_ERLANG
- .section ".text"
+ TEXT
/*
* int x86_call_to_native(Process *p);
* Emulated code recursively calls native code.
*/
.align 4
- .global x86_call_to_native
- .global nbif_return
-x86_call_to_native:
+ GLOBAL(CSYM(x86_call_to_native))
+ GLOBAL(ASYM(nbif_return))
+CSYM(x86_call_to_native):
ENTER_FROM_C
/* get argument registers */
LOAD_ARG_REGS
@@ -77,7 +77,7 @@ x86_call_to_native:
*
* This is where native code returns to emulated code.
*/
-nbif_return:
+ASYM(nbif_return):
movq %rax, P_ARG0(P) # save retval
movl $HIPE_MODE_SWITCH_RES_RETURN, %eax
/* FALLTHROUGH to .flush_exit
@@ -118,8 +118,8 @@ nbif_return:
* XXX: Different stubs for different number of register parameters?
*/
.align 4
- .global nbif_callemu
-nbif_callemu:
+ GLOBAL(ASYM(nbif_callemu))
+ASYM(nbif_callemu):
STORE_ARG_REGS
movl $HIPE_MODE_SWITCH_RES_CALL, %eax
jmp .suspend_exit
@@ -128,8 +128,8 @@ nbif_callemu:
* nbif_apply
*/
.align 4
- .global nbif_apply
-nbif_apply:
+ GLOBAL(ASYM(nbif_apply))
+ASYM(nbif_apply):
STORE_ARG_REGS
movl $HIPE_MODE_SWITCH_RES_APPLY, %eax
jmp .suspend_exit
@@ -145,8 +145,8 @@ nbif_apply:
*/
#if NR_ARG_REGS >= 6
.align 4
- .global nbif_ccallemu6
-nbif_ccallemu6:
+ GLOBAL(ASYM(nbif_ccallemu6))
+ASYM(nbif_ccallemu6):
movq ARG5, P_ARG5(P)
#if NR_ARG_REGS > 6
movq ARG6, ARG5
@@ -158,8 +158,8 @@ nbif_ccallemu6:
#if NR_ARG_REGS >= 5
.align 4
- .global nbif_ccallemu5
-nbif_ccallemu5:
+ GLOBAL(ASYM(nbif_ccallemu5))
+ASYM(nbif_ccallemu5):
movq ARG4, P_ARG4(P)
#if NR_ARG_REGS > 5
movq ARG5, ARG4
@@ -171,8 +171,8 @@ nbif_ccallemu5:
#if NR_ARG_REGS >= 4
.align 4
- .global nbif_ccallemu4
-nbif_ccallemu4:
+ GLOBAL(ASYM(nbif_ccallemu4))
+ASYM(nbif_ccallemu4):
movq ARG3, P_ARG3(P)
#if NR_ARG_REGS > 4
movq ARG4, ARG3
@@ -184,8 +184,8 @@ nbif_ccallemu4:
#if NR_ARG_REGS >= 3
.align 4
- .global nbif_ccallemu3
-nbif_ccallemu3:
+ GLOBAL(ASYM(nbif_ccallemu3))
+ASYM(nbif_ccallemu3):
movq ARG2, P_ARG2(P)
#if NR_ARG_REGS > 3
movq ARG3, ARG2
@@ -197,8 +197,8 @@ nbif_ccallemu3:
#if NR_ARG_REGS >= 2
.align 4
- .global nbif_ccallemu2
-nbif_ccallemu2:
+ GLOBAL(ASYM(nbif_ccallemu2))
+ASYM(nbif_ccallemu2):
movq ARG1, P_ARG1(P)
#if NR_ARG_REGS > 2
movq ARG2, ARG1
@@ -210,8 +210,8 @@ nbif_ccallemu2:
#if NR_ARG_REGS >= 1
.align 4
- .global nbif_ccallemu1
-nbif_ccallemu1:
+ GLOBAL(ASYM(nbif_ccallemu1))
+ASYM(nbif_ccallemu1):
movq ARG0, P_ARG0(P)
#if NR_ARG_REGS > 1
movq ARG1, ARG0
@@ -222,8 +222,8 @@ nbif_ccallemu1:
#endif
.align 4
- .global nbif_ccallemu0
-nbif_ccallemu0:
+ GLOBAL(ASYM(nbif_ccallemu0))
+ASYM(nbif_ccallemu0):
/* We use %rsi not ARG0 here because ARG0 is not
defined when NR_ARG_REGS == 0. */
#if NR_ARG_REGS == 0
@@ -237,8 +237,8 @@ nbif_ccallemu0:
* This is where native code suspends.
*/
.align 4
- .global nbif_suspend_0
-nbif_suspend_0:
+ GLOBAL(ASYM(nbif_suspend_0))
+ASYM(nbif_suspend_0):
movl $HIPE_MODE_SWITCH_RES_SUSPEND, %eax
jmp .suspend_exit
@@ -246,8 +246,8 @@ nbif_suspend_0:
* Suspend from a receive (waiting for a message)
*/
.align 4
- .global nbif_suspend_msg
-nbif_suspend_msg:
+ GLOBAL(ASYM(nbif_suspend_msg))
+ASYM(nbif_suspend_msg):
movl $HIPE_MODE_SWITCH_RES_WAIT, %eax
jmp .suspend_exit
@@ -257,8 +257,8 @@ nbif_suspend_msg:
* else { return 0; }
*/
.align 4
- .global nbif_suspend_msg_timeout
-nbif_suspend_msg_timeout:
+ GLOBAL(ASYM(nbif_suspend_msg_timeout))
+ASYM(nbif_suspend_msg_timeout):
movq P_FLAGS(P), %rax
/* this relies on F_TIMO (1<<2) fitting in a byte */
testb $F_TIMO, %al # F_TIMO set?
@@ -275,8 +275,8 @@ nbif_suspend_msg_timeout:
* Emulated code returns to its native code caller.
*/
.align 4
- .global x86_return_to_native
-x86_return_to_native:
+ GLOBAL(CSYM(x86_return_to_native))
+CSYM(x86_return_to_native):
ENTER_FROM_C
/* get return value */
movq P_ARG0(P), %rax
@@ -292,8 +292,8 @@ x86_return_to_native:
* Emulated code tailcalls native code.
*/
.align 4
- .global x86_tailcall_to_native
-x86_tailcall_to_native:
+ GLOBAL(CSYM(x86_tailcall_to_native))
+CSYM(x86_tailcall_to_native):
ENTER_FROM_C
/* get argument registers */
LOAD_ARG_REGS
@@ -305,8 +305,8 @@ x86_tailcall_to_native:
* Emulated code throws an exception to its native code caller.
*/
.align 4
- .global x86_throw_to_native
-x86_throw_to_native:
+ GLOBAL(CSYM(x86_throw_to_native))
+CSYM(x86_throw_to_native):
ENTER_FROM_C
/* invoke the handler */
jmp *P_NCALLEE(P) # set by hipe_find_handler()
@@ -315,15 +315,15 @@ x86_throw_to_native:
* This is the default exception handler for native code.
*/
.align 4
- .global nbif_fail
-nbif_fail:
+ GLOBAL(ASYM(nbif_fail))
+ASYM(nbif_fail):
movl $HIPE_MODE_SWITCH_RES_THROW, %eax
jmp .flush_exit
- .global nbif_0_gc_after_bif
- .global nbif_1_gc_after_bif
- .global nbif_2_gc_after_bif
- .global nbif_3_gc_after_bif
+ GLOBAL(nbif_0_gc_after_bif)
+ GLOBAL(nbif_1_gc_after_bif)
+ GLOBAL(nbif_2_gc_after_bif)
+ GLOBAL(nbif_3_gc_after_bif)
.align 4
nbif_0_gc_after_bif:
xorl %edx, %edx
@@ -346,7 +346,7 @@ nbif_3_gc_after_bif:
subq $(16-8), %rsp
movq P, %rdi
movq %rax, %rsi
- call erts_gc_after_bif_call
+ call CSYM(erts_gc_after_bif_call)
addq $(16-8), %rsp
movl $0, P_NARITY(P) # Note: narity is a 32-bit field
ret
@@ -356,10 +356,10 @@ nbif_3_gc_after_bif:
* exceptional condition.
* The stack/heap registers were just read from P.
*/
- .global nbif_0_simple_exception
- .global nbif_1_simple_exception
- .global nbif_2_simple_exception
- .global nbif_3_simple_exception
+ GLOBAL(nbif_0_simple_exception)
+ GLOBAL(nbif_1_simple_exception)
+ GLOBAL(nbif_2_simple_exception)
+ GLOBAL(nbif_3_simple_exception)
.align 4
nbif_0_simple_exception:
xorl %eax, %eax
@@ -389,7 +389,7 @@ nbif_3_simple_exception:
/* find and prepare to invoke the handler */
SWITCH_ERLANG_TO_C_QUICK # The cached state is clean and need not be saved.
movq P, %rdi
- call hipe_handle_exception # Note: hipe_handle_exception() conses
+ call CSYM(hipe_handle_exception) # Note: hipe_handle_exception() conses
SWITCH_C_TO_ERLANG # %rsp updated by hipe_find_handler()
/* now invoke the handler */
jmp *P_NCALLEE(P) # set by hipe_find_handler()
@@ -408,15 +408,15 @@ nbif_3_simple_exception:
* nbif_stack_trap_ra: trap return address for maintaining
* the gray/white stack boundary
*/
- .global nbif_stack_trap_ra
+ GLOBAL(ASYM(nbif_stack_trap_ra))
.align 4
-nbif_stack_trap_ra: # a return address, not a function
+ASYM(nbif_stack_trap_ra): # a return address, not a function
# This only handles a single return value.
# If we have more, we need to save them in the PCB.
movq %rax, TEMP_RV # save retval
SWITCH_ERLANG_TO_C_QUICK
movq P, %rdi
- call hipe_handle_stack_trap # must not cons; preserves TEMP_RV
+ call CSYM(hipe_handle_stack_trap) # must not cons; preserves TEMP_RV
movq %rax, %rdx # original RA
SWITCH_C_TO_ERLANG_QUICK
movq TEMP_RV, %rax # restore retval
@@ -425,15 +425,15 @@ nbif_stack_trap_ra: # a return address, not a function
/*
* nbif_inc_stack_0
*/
- .global nbif_inc_stack_0
+ GLOBAL(ASYM(nbif_inc_stack_0))
.align 4
-nbif_inc_stack_0:
+ASYM(nbif_inc_stack_0):
SWITCH_ERLANG_TO_C_QUICK
STORE_ARG_REGS
movq P, %rdi
# hipe_inc_nstack reads and writes NSP and NSP_LIMIT,
# but does not access HP or FCALLS (or the non-amd64 NRA).
- call hipe_inc_nstack
+ call CSYM(hipe_inc_nstack)
LOAD_ARG_REGS
SWITCH_C_TO_ERLANG_QUICK
NSP_RET0
diff --git a/erts/emulator/sys/common/erl_poll.c b/erts/emulator/sys/common/erl_poll.c
index 169d4579a2..5cca33d7eb 100644
--- a/erts/emulator/sys/common/erl_poll.c
+++ b/erts/emulator/sys/common/erl_poll.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2006-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2006-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -350,6 +350,7 @@ unset_interrupted_chk(ErtsPollSet ps)
#endif
+void erts_silence_warn_unused_result(long unused);
static void fatal_error(char *format, ...);
static void fatal_error_async_signal_safe(char *error_str);
@@ -2554,8 +2555,10 @@ fatal_error_async_signal_safe(char *error_str)
int len = 0;
while (error_str[len])
len++;
- if (len)
- (void) write(2, error_str, len); /* async signal safe */
+ if (len) {
+ /* async signal safe */
+ erts_silence_warn_unused_result(write(2, error_str, len));
+ }
}
abort();
}
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index 183525b222..31ab5d03de 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 1996-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 1996-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -709,7 +709,7 @@ prepare_crash_dump(void)
if (nice_val > 39) {
nice_val = 39;
}
- nice(nice_val);
+ erts_silence_warn_unused_result(nice(nice_val));
}
envsz = sizeof(env);
@@ -2332,7 +2332,7 @@ sys_async_ready_failed(int fd, int r, int err)
char buf[120];
sprintf(buf, "sys_async_ready(): Fatal error: fd=%d, r=%d, errno=%d\n",
fd, r, err);
- (void) write(2, buf, strlen(buf));
+ erts_silence_warn_unused_result(write(2, buf, strlen(buf)));
abort();
}
@@ -2891,7 +2891,7 @@ smp_sig_notify(char c)
char msg[] =
"smp_sig_notify(): Failed to notify signal-dispatcher thread "
"about received signal";
- (void) write(2, msg, sizeof(msg));
+ erts_silence_warn_unused_result(write(2, msg, sizeof(msg)));
abort();
}
}
@@ -3121,7 +3121,6 @@ erl_sys_args(int* argc, char** argv)
*argc = j;
}
-
#ifdef ERTS_TIMER_THREAD
/*
diff --git a/erts/emulator/sys/unix/sys_float.c b/erts/emulator/sys/unix/sys_float.c
index 15da6ab45c..c59c99f65e 100644
--- a/erts/emulator/sys/unix/sys_float.c
+++ b/erts/emulator/sys/unix/sys_float.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2001-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2001-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -93,7 +93,8 @@ void erts_fp_check_init_error(volatile unsigned long *fpexnp)
char buf[64];
snprintf(buf, sizeof buf, "ERTS_FP_CHECK_INIT at %p: detected unhandled FPE at %p\r\n",
__builtin_return_address(0), (void*)*fpexnp);
- write(2, buf, strlen(buf));
+ if (write(2, buf, strlen(buf)) <= 0)
+ erl_exit(ERTS_ABORT_EXIT, "%s", buf);
*fpexnp = 0;
#if defined(__i386__) || defined(__x86_64__)
erts_restore_fpu();
diff --git a/erts/emulator/zlib/Makefile.in b/erts/emulator/zlib/Makefile.in
index 5c99b460c1..b44a87551d 100644
--- a/erts/emulator/zlib/Makefile.in
+++ b/erts/emulator/zlib/Makefile.in
@@ -14,12 +14,7 @@
# make install prefix=$HOME
ARFLAGS = rc
-ifeq ($(findstring ose,$(TARGET)),ose)
- TYPE_FLAGS =
-else
- TYPE_FLAGS = -O3
-endif
-CFLAGS = @CFLAGS@ @DEFS@ @EMU_THR_DEFS@ $(TYPE_FLAGS)
+CFLAGS = $(subst -O2, -O3, @CFLAGS@ @DEFS@ @EMU_THR_DEFS@)
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
@@ -36,24 +31,15 @@ OBJS = $(O:%=$(OBJDIR)/%)
include $(ERL_TOP)/make/target.mk
-# On windows we need a separate zlib during debug build
-ifeq ($(TARGET),win32)
-
-ifeq ($(TYPE),debug)
-CFLAGS = $(subst -O2, -g, @CFLAGS@ @DEFS@ @DEBUG_FLAGS@)
-endif # debug
-
-else # win32
-
ifeq ($(TYPE),gcov)
-CFLAGS = $(subst -O2, -g, -O0 -fprofile-arcs -ftest-coverage @CFLAGS@ @DEFS@ @DEBUG_FLAGS@)
-TYPE_FLAGS=
+CFLAGS = -O0 -fprofile-arcs -ftest-coverage @DEBUG_CFLAGS@ @DEFS@ @EMU_THR_DEFS@
else # gcov
-# On other platforms we use no special debug version of zlib
+ifeq ($(TYPE),debug)
+CFLAGS = @DEBUG_CFLAGS@ @DEFS@ @EMU_THR_DEFS@
+endif # debug
endif # gcov
-endif # win32
-
+# On windows we *need* a separate zlib during debug build
OBJDIR= $(ERL_TOP)/erts/emulator/zlib/obj/$(TARGET)/$(TYPE)
include $(ERL_TOP)/make/$(TARGET)/otp.mk