浏览代码

have ldso track replacement of aligned_alloc

this is in preparation for improving behavior of malloc interposition.
Rich Felker 4 年之前
父节点
当前提交
e9f4fd1185
共有 3 个文件被更改,包括 4 次插入0 次删除
  1. 2 0
      ldso/dynlink.c
  2. 1 0
      src/internal/dynlink.h
  3. 1 0
      src/malloc/replaced.c

+ 2 - 0
ldso/dynlink.c

@@ -1935,6 +1935,8 @@ void __dls3(size_t *sp, size_t *auxv)
 	 * possibility of incomplete replacement. */
 	 * possibility of incomplete replacement. */
 	if (find_sym(head, "malloc", 1).dso != &ldso)
 	if (find_sym(head, "malloc", 1).dso != &ldso)
 		__malloc_replaced = 1;
 		__malloc_replaced = 1;
+	if (find_sym(head, "aligned_alloc", 1).dso != &ldso)
+		__aligned_alloc_replaced = 1;
 
 
 	/* Switch to runtime mode: any further failures in the dynamic
 	/* Switch to runtime mode: any further failures in the dynamic
 	 * linker are a reportable failure rather than a fatal startup
 	 * linker are a reportable failure rather than a fatal startup

+ 1 - 0
src/internal/dynlink.h

@@ -106,6 +106,7 @@ hidden void __dl_vseterr(const char *, va_list);
 hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic();
 hidden ptrdiff_t __tlsdesc_static(), __tlsdesc_dynamic();
 
 
 hidden extern int __malloc_replaced;
 hidden extern int __malloc_replaced;
+hidden extern int __aligned_alloc_replaced;
 hidden void __malloc_donate(char *, char *);
 hidden void __malloc_donate(char *, char *);
 hidden int __malloc_allzerop(void *);
 hidden int __malloc_allzerop(void *);
 
 

+ 1 - 0
src/malloc/replaced.c

@@ -1,3 +1,4 @@
 #include "dynlink.h"
 #include "dynlink.h"
 
 
 int __malloc_replaced;
 int __malloc_replaced;
+int __aligned_alloc_replaced;