|
@@ -0,0 +1,44 @@
|
|
|
+/*
|
|
|
+ * Copyright Rubber Duck Software P.C.
|
|
|
+ *
|
|
|
+ * Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
+ * you may not use this file except in compliance with the License.
|
|
|
+ * You may obtain a copy of the License at
|
|
|
+ *
|
|
|
+ * http://www.apache.org/licenses/LICENSE-2.0
|
|
|
+ *
|
|
|
+ * Unless required by applicable law or agreed to in writing, software
|
|
|
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
+ * See the License for the specific language governing permissions and
|
|
|
+ * limitations under the License.
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * @file src/glibc_hooks.c
|
|
|
+ * @author Ioannis Koutras (joko@rdsoftware.eu)
|
|
|
+ * @date October 2013
|
|
|
+ *
|
|
|
+ * @brief Override GLIBC hooks with dmmlib's functions
|
|
|
+ */
|
|
|
+
|
|
|
+#include <features.h>
|
|
|
+
|
|
|
+#if (defined(__GLIBC__) && !defined(__UCLIBC__))
|
|
|
+
|
|
|
+#include <stddef.h>
|
|
|
+#include <dmmlib/memalign.h>
|
|
|
+
|
|
|
+/*
|
|
|
+ * glibc provides the RTLD_DEEPBIND flag for dlopen which can make it possible
|
|
|
+ * to inconsistently reference libc's malloc(3)-compatible functions
|
|
|
+ * (https://bugzilla.mozilla.org/show_bug.cgi?id=493541).
|
|
|
+ *
|
|
|
+ * These definitions interpose hooks in glibc. The functions are actually
|
|
|
+ * passed an extra argument for the caller return address, which will be
|
|
|
+ * ignored.
|
|
|
+ */
|
|
|
+void *(* __memalign_hook)(size_t alignment, size_t size) = memalign;
|
|
|
+
|
|
|
+#endif /* __GLIBC__ && !__UCLIBC__ */
|