소스 검색

[libgcc] Provide symbol to handle gcc's implicit calls to memset()

On some architectures (such as ARM), gcc will insert implicit calls to
memset().  Handle these using the same mechanism as for the implicit
calls to memcpy() used by x86.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 년 전
부모
커밋
55e409b14f
2개의 변경된 파일26개의 추가작업 그리고 18개의 파일을 삭제
  1. 26
    0
      src/libgcc/implicit.c
  2. 0
    18
      src/libgcc/memcpy.c

+ 26
- 0
src/libgcc/implicit.c 파일 보기

@@ -0,0 +1,26 @@
1
+/** @file
2
+ *
3
+ * gcc sometimes likes to insert implicit calls to memcpy() and
4
+ * memset().  Unfortunately, there doesn't seem to be any way to
5
+ * prevent it from doing this, or to force it to use the optimised
6
+ * versions as seen by C code; it insists on inserting symbol
7
+ * references to "memcpy" and "memset".  We therefore include wrapper
8
+ * functions just to keep gcc happy.
9
+ *
10
+ */
11
+
12
+#include <string.h>
13
+
14
+void * gcc_implicit_memcpy ( void *dest, const void *src,
15
+			     size_t len ) asm ( "memcpy" );
16
+
17
+void * gcc_implicit_memcpy ( void *dest, const void *src, size_t len ) {
18
+	return memcpy ( dest, src, len );
19
+}
20
+
21
+void * gcc_implicit_memset ( void *dest, int character,
22
+			     size_t len ) asm ( "memset" );
23
+
24
+void * gcc_implicit_memset ( void *dest, int character, size_t len ) {
25
+	return memset ( dest, character, len );
26
+}

+ 0
- 18
src/libgcc/memcpy.c 파일 보기

@@ -1,18 +0,0 @@
1
-/** @file
2
- *
3
- * gcc sometimes likes to insert implicit calls to memcpy().
4
- * Unfortunately, there doesn't seem to be any way to prevent it from
5
- * doing this, or to force it to use the optimised memcpy() as seen by
6
- * C code; it insists on inserting a symbol reference to "memcpy".  We
7
- * therefore include wrapper functions just to keep gcc happy.
8
- *
9
- */
10
-
11
-#include <string.h>
12
-
13
-void * gcc_implicit_memcpy ( void *dest, const void *src,
14
-			     size_t len ) asm ( "memcpy" );
15
-
16
-void * gcc_implicit_memcpy ( void *dest, const void *src, size_t len ) {
17
-	return memcpy ( dest, src, len );
18
-}

Loading…
취소
저장