libsupc++ Makefile

git-svn-id: svn://kolibrios.org@6556 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2016-09-29 11:02:20 +00:00
parent b6f602747e
commit 3c17dd1ccd
7 changed files with 167 additions and 237 deletions

View File

@ -35,13 +35,13 @@ cxx98_sources = \
src/c++98/compatibility-debug_list-2.cc
cxx11_sources = \
compatibility-c++0x.cc \
compatibility-atomic-c++0x.cc \
compatibility-thread-c++0x.cc \
compatibility-chrono.cc \
compatibility-condvar.cc
src/c++11/compatibility-c++0x.cc \
src/c++11/compatibility-atomic-c++0x.cc \
src/c++11/compatibility-thread-c++0x.cc \
src/c++11/compatibility-chrono.cc \
src/c++11/compatibility-condvar.cc
compat_sources = $(cxx98_sources)
compat_sources = $(cxx98_sources) $(cxx11_sources)
cow_string_host_sources = \
src/c++98/collate_members_cow.cc \
@ -244,7 +244,19 @@ src/c++98/parallel_settings.o: src/c++98/parallel_settings.cc
src/c++11/hashtable_c++0x.o: src/c++11/hashtable_c++0x.cc
$(CXXCOMPILE) -fimplicit-templates -o $@ $<
$(CXXCOMPILE) -std=gnu++11 -fimplicit-templates -o $@ $<
src/c++11/compatibility-c++0x.o: src/c++11/compatibility-c++0x.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
src/c++11/compatibility-thread-c++0x.o: src/c++11/compatibility-thread-c++0x.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
src/c++11/compatibility-chrono.o: src/c++11/compatibility-chrono.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
src/c++11/compatibility-condvar.o: src/c++11/compatibility-condvar.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
clean:
-rm -f *.o

View File

@ -6,68 +6,81 @@ LD = kos32-ld
CPP= kos32-g++
STRIP = kos32-strip
INSTALLDIR:= /home/autobuild/tools/win32/mingw32/lib
export SDK_DIR:= $(abspath ../../../../../sdk)
CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -c -O2 -fno-ident -fomit-frame-pointer
CPPFLAGS = -fno-rtti
CFLAGSCPP = -nostdinc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi
CFLAGSCPP+= -fdiagnostics-show-location=once -ffunction-sections -fdata-sections
ARFLAGS= crs
INCLUDES= -I. -I../include/mingw32 -I../include -I../../newlib/libc/include -I/home/autobuild/tools/win32/include
GLIBCXX_INCLUDE_DIR= ../include
INCLUDES= -I../include/mingw32 -I../include -I./ -I$(SDK_DIR)/sources/newlib/libc/include
LIBS:= -ldll -lc.dll
DEFINES= -D_GLIBCXX_HAVE_TLS
DEFINES= -DHAVE_CONFIG_H -DIN_GCC -DIN_GLIBCPP_V3 -DUSE_EMUTLS=1 -D_GLIBCXX_HAVE_TLS
C_COMPILE= $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES)
CXXCOMPILE= $(CPP) $(CFLAGS) $(CFLAGSCPP) $(INCLUDES) $(DEFINES)
SOURCES = \
cp-demangle.c \
array_type_info.cc \
atexit_thread.cc \
bad_alloc.cc \
bad_cast.cc \
bad_typeid.cc \
class_type_info.cc \
del_op.cc \
del_opnt.cc \
del_opv.cc \
del_opvnt.cc \
dyncast.cc \
eh_alloc.cc \
eh_aux_runtime.cc \
eh_call.cc \
eh_catch.cc \
eh_exception.cc \
eh_globals.cc \
eh_personality.cc \
eh_ptr.cc \
eh_term_handler.cc \
eh_terminate.cc \
eh_throw.cc \
eh_tm.cc \
eh_type.c \
eh_unex_handler.cc \
enum_type_info.cc \
function_type_info.cc \
fundamental_type_info.cc \
guard.cc \
guard_error.cc \
hash_bytes.cc \
nested_exception.cc \
new_handler.cc \
new_op.cc \
new_opnt.cc \
new_opv.cc \
new_opvnt.cc \
pbase_type_info.cc \
pmem_type_info.cc \
pointer_type_info.cc \
pure.cc \
si_class_type_info.cc \
tinfo.cc \
tinfo2.cc \
vec.cc \
vmi_class_type_info.cc \
vterminate.cc
cp-demangle.c \
array_type_info.cc \
atexit_arm.cc \
atexit_thread.cc \
bad_alloc.cc \
bad_array_length.cc \
bad_array_new.cc \
bad_cast.cc \
bad_typeid.cc \
class_type_info.cc \
del_op.cc \
del_ops.cc \
del_opnt.cc \
del_opv.cc \
del_opvs.cc \
del_opvnt.cc \
dyncast.cc \
eh_alloc.cc \
eh_arm.cc \
eh_aux_runtime.cc \
eh_call.cc \
eh_catch.cc \
eh_exception.cc \
eh_globals.cc \
eh_personality.cc \
eh_ptr.cc \
eh_term_handler.cc \
eh_terminate.cc \
eh_tm.cc \
eh_throw.cc \
eh_type.cc \
eh_unex_handler.cc \
enum_type_info.cc \
function_type_info.cc \
fundamental_type_info.cc \
guard.cc \
guard_error.cc \
hash_bytes.cc \
nested_exception.cc \
new_handler.cc \
new_op.cc \
new_opnt.cc \
new_opv.cc \
new_opvnt.cc \
pbase_type_info.cc \
pmem_type_info.cc \
pointer_type_info.cc \
pure.cc \
si_class_type_info.cc \
tinfo.cc \
tinfo2.cc \
vec.cc \
vmi_class_type_info.cc \
vterminate.cc
OBJECTS = $(patsubst %.cc, %.o, $(patsubst %.c, %.o, $(SOURCES)))
@ -76,29 +89,60 @@ OBJECTS = $(patsubst %.cc, %.o, $(patsubst %.c, %.o, $(SOURCES)))
all:$(LIBRARY).a
$(LIBRARY).a: $(OBJECTS) Makefile
$(AR) $(ARFLAGS) $(LIBRARY).a $(OBJECTS)
mv -f $(LIBRARY).a ../../../lib
$(AR) $(ARFLAGS) $(LIBRARY).a $(OBJECTS)
mv -f $(LIBRARY).a $(INSTALLDIR)
%.o : %.c Makefile
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
%.o : %.cc Makefile
$(CPP) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
$(CXXCOMPILE) -o $@ $<
eh_ptr.o: eh_ptr.cc
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
cp-demangle.o: cp-demangle.c
$(C_COMPILE) -DHAVE_CONFIG_H -D_USE_32BIT_TIME_T -DIN_GLIBCPP_V3 -Wno-error -o $@ $<
bad_array_length.o: bad_array_length.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
bad_array_new.o: bad_array_new.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
eh_aux_runtime.o: eh_aux_runtime.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
eh_ptr.o: eh_ptr.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
eh_terminate.o: eh_terminate.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
eh_throw.o: eh_throw.cc
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
guard.o: guard.cc
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
guard.o: guard.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
atexit_thread.o: atexit_thread.cc
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
atexit_thread.o: atexit_thread.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
nested_exception.o: nested_exception.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
new_handler.o: new_handler.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
new_op.o: new_op.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
new_opnt.o: new_opnt.cc
$(CXXCOMPILE) -std=gnu++11 -o $@ $<
del_ops.o: del_ops.cc
$(CXXCOMPILE) -std=gnu++14 -o $@ $<
del_opvs.o: del_opvs.cc
$(CXXCOMPILE) -std=gnu++14 -o $@ $<
nested_exception.o: nested_exception.cc
$(CPP) $(CFLAGS) -std=gnu++0x $(CPPFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
clean:
-rm -f *.o

View File

@ -2302,7 +2302,7 @@ cplus_demangle_type (struct d_info *di)
*pret = d_function_type (di);
}
else
*pret = cplus_demangle_type (di);
*pret = cplus_demangle_type (di);
if (!*pret)
return NULL;
if ((*pret)->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS
@ -2397,11 +2397,11 @@ cplus_demangle_type (struct d_info *di)
candidate. */
if (! di->is_conversion)
{
if (! d_add_substitution (di, ret))
return NULL;
ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
d_template_args (di));
}
if (! d_add_substitution (di, ret))
return NULL;
ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
d_template_args (di));
}
else
{
struct demangle_component *args;
@ -4109,7 +4109,7 @@ cplus_demangle_print_callback (int options,
* sizeof (*dpi.copy_templates));
#endif
d_print_comp (&dpi, options, dc);
d_print_comp (&dpi, options, dc);
}
d_print_flush (&dpi);
@ -4334,7 +4334,7 @@ d_get_saved_scope (struct d_print_info *dpi,
static void
d_print_comp_inner (struct d_print_info *dpi, int options,
const struct demangle_component *dc)
const struct demangle_component *dc)
{
/* Magic variable to let reference smashing skip over the next modifier
without needing to modify *dc. */
@ -5785,9 +5785,9 @@ d_print_expr_op (struct d_print_info *dpi, int options,
static void
d_print_cast (struct d_print_info *dpi, int options,
const struct demangle_component *dc)
const struct demangle_component *dc)
{
d_print_comp (dpi, options, d_left (dc));
d_print_comp (dpi, options, d_left (dc));
}
/* Print a conversion operator. */
@ -5821,7 +5821,7 @@ d_print_conversion (struct d_print_info *dpi, int options,
parameters from scope after printing the operator name,
so we need to handle the template printing here. */
if (dpi->current_template != NULL)
dpi->templates = dpt.next;
dpi->templates = dpt.next;
if (d_last_char (dpi) == '<')
d_append_char (dpi, ' ');

View File

@ -122,6 +122,11 @@ struct d_info
mangled name to the demangled name, such as standard
substitutions and builtin types. */
int expansion;
/* Non-zero if we are parsing an expression. */
int is_expression;
/* Non-zero if we are parsing the type operand of a conversion
operator, but not when in an expression. */
int is_conversion;
};
/* To avoid running past the ending '\0', don't:

View File

@ -63,9 +63,10 @@ extern "C" {
#define DMGL_EDG (1 << 13)
#define DMGL_GNU_V3 (1 << 14)
#define DMGL_GNAT (1 << 15)
#define DMGL_DLANG (1 << 16)
/* If none of these are set, use 'current_demangling_style' as the default. */
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT)
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG)
/* Enumeration of possible demangling styles.
@ -87,7 +88,8 @@ extern enum demangling_styles
edg_demangling = DMGL_EDG,
gnu_v3_demangling = DMGL_GNU_V3,
java_demangling = DMGL_JAVA,
gnat_demangling = DMGL_GNAT
gnat_demangling = DMGL_GNAT,
dlang_demangling = DMGL_DLANG
} current_demangling_style;
/* Define string names for the various demangling styles. */
@ -102,6 +104,7 @@ extern enum demangling_styles
#define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3"
#define JAVA_DEMANGLING_STYLE_STRING "java"
#define GNAT_DEMANGLING_STYLE_STRING "gnat"
#define DLANG_DEMANGLING_STYLE_STRING "dlang"
/* Some macros to test what demangling style is active. */
@ -115,6 +118,7 @@ extern enum demangling_styles
#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)
#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)
#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)
#define DLANG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_DLANG)
/* Provide information about the available demangle styles. This code is
pulled from gdb into libiberty because it is useful to binutils also. */
@ -169,10 +173,17 @@ java_demangle_v3 (const char *mangled);
char *
ada_demangle (const char *mangled, int options);
extern char *
dlang_demangle (const char *mangled, int options);
enum gnu_v3_ctor_kinds {
gnu_v3_complete_object_ctor = 1,
gnu_v3_base_object_ctor,
gnu_v3_complete_object_allocating_ctor,
/* These are not part of the V3 ABI. Unified constructors are generated
as a speed-for-space optimization when the -fdeclone-ctor-dtor option
is used, and are always internal symbols. */
gnu_v3_unified_ctor,
gnu_v3_object_ctor_group
};
@ -188,6 +199,10 @@ enum gnu_v3_dtor_kinds {
gnu_v3_deleting_dtor = 1,
gnu_v3_complete_object_dtor,
gnu_v3_base_object_dtor,
/* These are not part of the V3 ABI. Unified destructors are generated
as a speed-for-space optimization when the -fdeclone-ctor-dtor option
is used, and are always internal symbols. */
gnu_v3_unified_dtor,
gnu_v3_object_dtor_group
};
@ -365,6 +380,10 @@ enum demangle_component_type
/* A typecast, represented as a unary operator. The one subtree is
the type to which the argument should be cast. */
DEMANGLE_COMPONENT_CAST,
/* A conversion operator, represented as a unary operator. The one
subtree is the type to which the argument should be converted
to. */
DEMANGLE_COMPONENT_CONVERSION,
/* A nullary expression. The left subtree is the operator. */
DEMANGLE_COMPONENT_NULLARY,
/* A unary expression. The left subtree is the operator, and the

View File

@ -1,150 +0,0 @@
#include <stdlib.h>
#include <sys/errno.h>
#include <kos32sys.h>
void __mutex_lock(volatile int *val);
static inline int tls_get(int key)
{
int val;
__asm__ __volatile__(
"movl %%fs:(%1), %0"
:"=r"(val)
:"r"(key));
return val;
};
typedef struct {
int done;
long started;
} __gthread_once_t;
typedef struct {
int counter;
void *sema;
} __gthread_mutex_t;
typedef struct {
int counter;
int depth;
unsigned long owner;
int sema;
} __gthread_recursive_mutex_t;
int
__gthr_win32_once (__gthread_once_t *once, void (*func) (void))
{
if (once == NULL || func == NULL)
return EINVAL;
if (! once->done)
{
if (__sync_add_and_fetch (&(once->started), 1) == 0)
{
(*func) ();
once->done = 1;
}
else
{
/* Another thread is currently executing the code, so wait for it
to finish; yield the CPU in the meantime. If performance
does become an issue, the solution is to use an Event that
we wait on here (and set above), but that implies a place to
create the event before this routine is called. */
while (! once->done)
delay(1);
}
}
return 0;
}
void __gthr_win32_mutex_init_function (__gthread_mutex_t *mutex)
{
mutex->counter = 0;
mutex->sema = 0;
}
int __gthr_win32_mutex_lock (__gthread_mutex_t *mutex)
{
__mutex_lock(&mutex->counter);
return 0;
}
int
__gthr_win32_mutex_unlock (__gthread_mutex_t *mutex)
{
mutex->counter = 0;
return 0;
}
void
__gthr_win32_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
{
mutex->counter = -1;
mutex->depth = 0;
mutex->owner = 0;
mutex->sema = 0;
}
void
__gthr_win32_mutex_destroy (__gthread_mutex_t *mutex)
{ }
int
__gthr_win32_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
{
int me = tls_get(0);
if ( __sync_add_and_fetch(&mutex->counter, 1) == 0)
{
mutex->depth = 1;
mutex->owner = me;
mutex->sema = 1;
}
else if (mutex->owner == me)
{
__sync_sub_and_fetch(&mutex->counter, 1);
++(mutex->depth);
}
else
{
__mutex_lock(&mutex->sema);
mutex->depth = 1;
mutex->owner = me;
}
return 0;
}
int
__gthr_win32_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
{
int me = tls_get(0);
if (__sync_val_compare_and_swap (&mutex->counter, -1, 0) < 0)
{
mutex->depth = 1;
mutex->owner = me;
mutex->sema = 1;
}
else if (mutex->owner == me)
++(mutex->depth);
else
return 1;
return 0;
}
int
__gthr_win32_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
{
--(mutex->depth);
if (mutex->depth == 0)
{
mutex->owner = 0;
if (__sync_sub_and_fetch (&mutex->counter, 1) >= 0)
mutex->sema = 0;
}
return 0;
}