This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Contributing new gcc targets: i386-*-dragonfly and x86-64-*-dragonfly


Hello GCC developers,

For the last few years, I have been maintaining a large set of patches
that add support for the DragonFly BSD target and also complete Ada
frontend support on all four major BSDs among other things.  Before I
can submit patches for Ada or testsuite cases, DragonFly must be a
recognized, working target.  The patches attached here will provide
out-of-the-box support for the C, C++, Objective-C and Fortran frontends.

Most of the changes should be self-explanatory except for the following:

dl_iterate_phr: This was hard-coded to FreeBSD version, but
dl_iterate_phdr support is easily detected the same way on FreeBSD and
DragonFly (if/when NetBSD/OpenBSD get dl_iterate_phdr functionality then
it can be detected similarly with different headers).  So I piggy-backed
on existing functionality in place for solaris, and then adjusted
crtstuff.c and unwind-dw2-fde-dip.c to use TARGET_DL_ITERATE_PHDR
instead of the hardcode versioning.

enable_execute_stack=enable-execute-stack-mprotect.c: This never worked
correctly on FreeBSD, at least it did not the last time I checked this
in the GCC 4.7 time-frame and I don't think anything changed since then.
 I added a different version (enable-execute-stack-bsd.c) that does work
and assigned all the BSDs to use this version instead of the mprotect.c
version.  It's been almost 2 years since I did those so I can't remember
exactly what was failing with the mprotect.c version, but the effects
were clearly seen with Ada testsuite failures (and subsequently fixed
with my new version).

unwind support:  Unwind supports works great for DragonFly.  I also have
a patch to add unwind support for FreeBSD, but I did not include it here
because it is out of scope.  The FreeBSD version is *not* the same, and
the FreeBSD version is made more complicated because signal trampolines
are handled differently on i386 platforms and amd64 platforms running in
32-bit compat mode (meaning a program would work perfectly fine on a
"real" i386 but fail on amd64 in 32-bit compatibility mode).  Anyway, a
follow-up to this patch submission is adding the FreeBSD unwind support
as a separate submission.

I ran (modified) testsuites on FreeBSD-10-amd64 and DragonFly-dev-86_64.
 A summary of both is as follows:

g++ Summary                FreeBSD     DragonFly
================================================
# of expected passes       83178       82367
# of unexpected failures   18          305
# of unexpected successes  2
# of expected failures     443         445
# of unresolved testcases  48          326
# of unsupported tests     3000        2963


gcc Summary                FreeBSD     DragonFly
================================================
# of expected passes       101595      98822
# of unexpected failures   72          346
# of expected failures     251         251
# of unresolved testcases  24          234
# of unsupported tests     1511        1457


gfortran Summary           FreeBSD     DragonFly
================================================
# of expected passes       45496       45512
# of unexpected successes  7           9
# of expected failures     47          38
# of unresolved testcases  8           8
# of unsupported tests     79          70


libgomp Summary            FreeBSD     DragonFly
================================================
# of expected passes       2363        2357
# of unsupported tests                 3


libitm Summary             FreeBSD     DragonFly
================================================
# of expected passes       26          26
# of expected failures     3           3
# of unsupported tests     1           1


libstdc++ Summary          FreeBSD     DragonFly
================================================
# of expected passes       8764        9198
# of unexpected failures   25          178
# of expected failures     40          41
# of unsupported tests     645         351
# of unexpected successes              1


objc Summary               FreeBSD     DragonFly
================================================
# of expected passes       2988        2988
# of expected failures     6           6
# of unsupported tests     74          74


In some tests, DragonFly actually does better than FreeBSD.  Some of the
differences are caused by dejagnu instructions (e.g. the unsupported
libgomp tests).  All in all, a pretty good showing for a baseline in my
opinion.  Here is my suggested commit message:

2014-04-20  John Marino <gnugcc@marino.st>

	* gcc/config.gcc (*-*-dragonfly*): New target
	* gcc/configure.ac: detect dl_iterate_phdr (*freebsd*, *dragonfly*)
	* gcc/configure: regenerate
	* gcc/config/dragonfly-stdint.h: new
	* gcc/config/dragonfly.h: new
	* gcc/config/dragonfly.opt: new
	* gcc/config/i386/dragonfly.h: new
	* gcc/ginclude/stddef: detect _PTRDIFF_T_DECLARED and include
	  <sys/types> for DragonFly
	* include/liberty.h: use basename function on DragonFly
	* libcilkrts/runtime/os-unix.c (__DragonFly__): New target
	* libgcc/config.host (*-*-dragonfly*): New target
	* libgcc/crtstuff.c: Make dl_iterate_support generic on *bsd
	* libgcc/enable-execute-stack-bsd.c: new
	* libgcc/unwind-dw2-fde-dip.c: dl_iterate_phr support for DragonFly
	* libgcc/config/i386/dragonfly-unwind.h: new
	* libitm/configure.tgt (*-*-dragonfly*): New target
	* libstdc++-v3/acinclude.m4 (*-*-dragonfly*): New target
	* libstdc++-v3/configure: regenerate
	* libstdc++-v3/configure.host (*-*-dragonfly*): New target
	* libstdc++-v3/config/locale/dragonfly/c_locale.cc: new
	* libstdc++-v3/config/locale/dragonfly/ctype_members.cc: new
	* libstdc++-v3/config/os/bsd/dragonfly/ctype_base.h: new
	* libstdc++-v3/config/os/bsd/dragonfly/ctype_configure_char.cc: new
	* libstdc++-v3/config/os/bsd/dragonfly/ctype_inline.h: new
	* libstdc++-v3/config/os/bsd/dragonfly/os_defines.h

The individual Changelog entries can be obtained (see list below).

It would be great these patches could be reviewed and approved quickly
for addition to trunk.  Most of the changes clearly affect only
DragonFly, but there are a few changes that affect many platforms.

Regards,
John Marino (DragonFly, FreeBSD, and NetBSD committer)
FSF Assignment: RT658681 (18 FEB 2011)


Resource list:
1. Entries for 6 change logs:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/changelog_entries/
2. Proposed commit message:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/proposed_commit-msg.txt
3. Full set of test logs for FreeBSD:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/test-results/freebsd10-amd64/
4. Full set of test logs for DragonFly:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/test-results/df-dev-x86_64/
5. Shar file to create test port (FreeBSD ports and DragonFly dports):
http://leaf.dragonflybsd.org/~marino/gcc-df-target/gcc410.shar.txt
6. Detail list of testsuite modifications for those results:
http://leaf.dragonflybsd.org/~marino/gcc-df-target/patches/additional_testsuite_mods.txt
7. Testsuite patches (will submit later):
http://leaf.dragonflybsd.org/~marino/gcc-df-target/patches/patch-testsuite

Attachment: patch-dragonfly-target.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]