diff options
author | ljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-01 18:13:18 +0000 |
---|---|---|
committer | ljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-01 18:13:18 +0000 |
commit | a52d03ef3b70078fd0100725b44b6713ab766b5b (patch) | |
tree | 8209ef794f609d9633cb0454279034f2a39a2e45 | |
parent | b85203523523bbd7772e2e7ca5e3b53cf0db1d5d (diff) | |
download | gcc-a52d03ef3b70078fd0100725b44b6713ab766b5b.tar.gz |
2009-09-01 Loren J. Rittle <ljrittle@acm.org>
* mf-runtime.c (__mf_init): Support FreeBSD.
Prime mutex which calls calloc upon first lock to avoid deadlock.
* mf-hooks1.c (__mf_0fn_mmap): Support FreeBSD.
Ignore red zone allocation request for initial thread's stack.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151278 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libmudflap/ChangeLog | 7 | ||||
-rw-r--r-- | libmudflap/mf-hooks1.c | 5 | ||||
-rw-r--r-- | libmudflap/mf-runtime.c | 6 |
3 files changed, 18 insertions, 0 deletions
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog index 5a899c18551..e51c109bbac 100644 --- a/libmudflap/ChangeLog +++ b/libmudflap/ChangeLog @@ -1,4 +1,11 @@ 2009-09-01 Loren J. Rittle <ljrittle@acm.org> + + * mf-runtime.c (__mf_init): Support FreeBSD. + Prime mutex which calls calloc upon first lock to avoid deadlock. + * mf-hooks1.c (__mf_0fn_mmap): Support FreeBSD. + Ignore red zone allocation request for initial thread's stack. + +2009-09-01 Loren J. Rittle <ljrittle@acm.org> Andreas Schwab <schwab@linux-m68k.org> * testsuite/libmudflap.c/pass51-frag.c (MAP_FAILED): Define, diff --git a/libmudflap/mf-hooks1.c b/libmudflap/mf-hooks1.c index e74c13afcce..1e46a650947 100644 --- a/libmudflap/mf-hooks1.c +++ b/libmudflap/mf-hooks1.c @@ -321,6 +321,11 @@ WRAPPER(void, free, void *buf) void * __mf_0fn_mmap (void *start, size_t l, int prot, int f, int fd, off_t off) { +#if defined(__FreeBSD__) + if (f == 0x1000 && fd == -1 && prot == 0 && off == 0) + return 0; +#endif /* Ignore red zone allocation request for initial thread's stack. */ + return (void *) -1; } #endif diff --git a/libmudflap/mf-runtime.c b/libmudflap/mf-runtime.c index 46e7e2fc30e..3bfaf02b6a0 100644 --- a/libmudflap/mf-runtime.c +++ b/libmudflap/mf-runtime.c @@ -695,6 +695,12 @@ __mf_init () if (LIKELY (__mf_starting_p == 0)) return; +#if defined(__FreeBSD__) && defined(LIBMUDFLAPTH) + pthread_self(); + LOCKTH (); + UNLOCKTH (); +#endif /* Prime mutex which calls calloc upon first lock to avoid deadlock. */ + /* This initial bootstrap phase requires that __mf_starting_p = 1. */ #ifdef PIC __mf_resolve_dynamics (); |