Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

[ports] Build and pass testsuite on i386 freebsd #138

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2015-08-22 Iain Buclaw <[email protected]>

* toir.cc(IRVisitor::visit(TryCatchStatement)): Always emit call to
LIBCALL_BEGIN_CATCH at the start of the catch.

2015-08-20 Iain Buclaw <[email protected]>

* toir.cc(IRVisitor::visit): Set input location in all visitors that
Expand Down
17 changes: 12 additions & 5 deletions gcc/d/toir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,14 @@ class IRVisitor : public Visitor
this->start_scope(level_catch);

tree catchtype = build_ctype(vcatch->type);

// Get D's internal exception Object, different from the generic
// exception pointer returned from gcc runtime.
tree ehptr = d_build_call_nary(builtin_decl_explicit(BUILT_IN_EH_POINTER),
1, integer_zero_node);
tree object = build_libcall(LIBCALL_BEGIN_CATCH, 1, &ehptr);
if (vcatch->var)
{
// Get D's internal exception Object, different
// from the generic exception pointer.
tree ehptr = d_build_call_nary(builtin_decl_explicit(BUILT_IN_EH_POINTER),
1, integer_zero_node);
tree object = build_libcall(LIBCALL_BEGIN_CATCH, 1, &ehptr);
object = build1(NOP_EXPR, build_ctype(build_object_type()), object);
object = convert_expr(object, build_object_type(), vcatch->type);

Expand All @@ -801,6 +802,12 @@ class IRVisitor : public Visitor
build_local_var(vcatch->var);
add_stmt(init);
}
else
{
// Still need to emit a call to __gdc_begin_catch() to remove
// the object from the uncaught exceptions list.
add_stmt(object);
}

if (vcatch->handler)
vcatch->handler->accept(this);
Expand Down
4 changes: 3 additions & 1 deletion libphobos/configure
Original file line number Diff line number Diff line change
Expand Up @@ -4570,9 +4570,11 @@ case "$d_target_os" in
D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OSX_OBJS)"
;;
freebsd*|k*bsd*-gnu)
DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_FREEBSD_OBJS)"
D_EXTRA_OBJS="$D_EXTRA_OBJS \$(FREEBSD_OBJS)"
;;
linux*) D_EXTRA_OBJS="$D_EXTRA_OBJS \$(LINUX_OBJS)"
linux*) DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_LINUX_OBJS)"
D_EXTRA_OBJS="$D_EXTRA_OBJS \$(LINUX_OBJS)"
;;
mingw*) DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_STDC_OBJS)"
DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_WINDOWS_OBJS)"
Expand Down
4 changes: 3 additions & 1 deletion libphobos/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,11 @@ case "$d_target_os" in
D_EXTRA_OBJS="$D_EXTRA_OBJS \$(OSX_OBJS)"
;;
freebsd*|k*bsd*-gnu)
DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_FREEBSD_OBJS)"
D_EXTRA_OBJS="$D_EXTRA_OBJS \$(FREEBSD_OBJS)"
;;
linux*) D_EXTRA_OBJS="$D_EXTRA_OBJS \$(LINUX_OBJS)"
linux*) DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_LINUX_OBJS)"
D_EXTRA_OBJS="$D_EXTRA_OBJS \$(LINUX_OBJS)"
;;
mingw*) DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_STDC_OBJS)"
DRUNTIME_OBJS="$DRUNTIME_OBJS \$(RT_WINDOWS_OBJS)"
Expand Down
2 changes: 1 addition & 1 deletion libphobos/libdruntime/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ RT_STDC_OBJS=core/stdc/config.o core/stdc/ctype.o core/stdc/errno.o \

RT_LINUX_OBJS=

RT_FREEBSD_OBJS=core/sys/freebsd/execinfo.o core/sys/freebsd/sys/event.o
RT_FREEBSD_OBJS=core/sys/freebsd/sys/event.o

RT_OSX_OBJS=core/sys/osx/mach/kern_return.o core/sys/osx/mach/port.o \
core/sys/osx/mach/semaphore.o core/sys/osx/mach/thread_act.o \
Expand Down
2 changes: 1 addition & 1 deletion libphobos/libdruntime/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ RT_STDC_OBJS = core/stdc/config.o core/stdc/ctype.o core/stdc/errno.o \
core/stdc/time.o core/stdc/wchar_.o

RT_LINUX_OBJS =
RT_FREEBSD_OBJS = core/sys/freebsd/execinfo.o core/sys/freebsd/sys/event.o
RT_FREEBSD_OBJS = core/sys/freebsd/sys/event.o
RT_OSX_OBJS = core/sys/osx/mach/kern_return.o core/sys/osx/mach/port.o \
core/sys/osx/mach/semaphore.o core/sys/osx/mach/thread_act.o \
core/sys/osx/pthread.o
Expand Down
5 changes: 5 additions & 0 deletions libphobos/libdruntime/core/runtime.d
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ private

// backtrace
version(GNU)
{
import gcc.builtins;
import gcc.backtrace;
}

version( linux )
import core.sys.linux.execinfo;
Expand Down Expand Up @@ -517,6 +520,8 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
else
version( D_InlineAsm_X86_64 )
asm { naked; mov RAX, RBP; ret; }
else version (GNU)
return cast(void**) __builtin_frame_address(0);
else
return null;
}
Expand Down
3 changes: 3 additions & 0 deletions libphobos/libdruntime/core/sys/freebsd/execinfo.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
*/
module core.sys.freebsd.execinfo;

version (GNU) {} // use gcc.backtrace
else:

version (FreeBSD):
extern (C):
nothrow:
Expand Down