-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i#3315,i#3348: Move mem{cpy,set,move} into memfuncs on AArchXX (#4309)
Provides isolation of mem{cpy,set,move} in the DR static library on AArchXX. Moves the assembly mem{cpy,set} into a separate memfuncs.asm for arm and aarch64, and links in memmove.c. Marks the __mem{cpy,set}_chk aliases as weak. This brings AArchXX into parity with x86 on library symbol isolation. Removes the exceptions for AArchXX in the CMake_symbol_check test. Confirms the build-time test fails without the code changes here: CMake Error at xxx/core/CMake_symbol_check.cmake:98 (message): *** Error: xxx/build_a64_dbg_tests/lib64/debug/libdynamorio_static_nohide.a contains a likely-to-conflict symbol: 4279: 00000000002cea3c 0 FUNC GLOBAL HIDDEN 248 memcpy Issue: #3315, #3348
- Loading branch information
1 parent
516ee2c
commit ef2c973
Showing
7 changed files
with
188 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* ********************************************************** | ||
* Copyright (c) 2019-2020 Google, Inc. All rights reserved. | ||
* Copyright (c) 2016 ARM Limited. All rights reserved. | ||
* **********************************************************/ | ||
|
||
/* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* * Neither the name of ARM Limited nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL ARM LIMITED OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
* DAMAGE. | ||
*/ | ||
|
||
/* | ||
* memfuncs.asm: Contains our custom memcpy and memset routines. | ||
* | ||
* See the long comment at the top of x86/memfuncs.asm. | ||
*/ | ||
|
||
#include "../asm_defines.asm" | ||
START_FILE | ||
#ifdef UNIX | ||
|
||
/* Private memcpy. | ||
* FIXME i#1569: We should optimize this as it can be on the critical path. | ||
*/ | ||
DECLARE_FUNC(memcpy) | ||
GLOBAL_LABEL(memcpy:) | ||
mov x3, ARG1 | ||
cbz ARG3, 2f | ||
1: ldrb w4, [ARG2], #1 | ||
strb w4, [x3], #1 | ||
sub ARG3, ARG3, #1 | ||
cbnz ARG3, 1b | ||
2: ret | ||
END_FUNC(memcpy) | ||
|
||
/* Private memset. | ||
* FIXME i#1569: we should optimize this as it can be on the critical path. | ||
*/ | ||
DECLARE_FUNC(memset) | ||
GLOBAL_LABEL(memset:) | ||
mov x3, ARG1 | ||
cbz ARG3, 2f | ||
1: strb w1, [x3], #1 | ||
sub ARG3, ARG3, #1 | ||
cbnz ARG3, 1b | ||
2: ret | ||
END_FUNC(memset) | ||
|
||
/* See x86.asm notes about needing these to avoid gcc invoking *_chk */ | ||
.global __memcpy_chk | ||
.hidden __memcpy_chk | ||
WEAK(__memcpy_chk) | ||
.set __memcpy_chk,memcpy | ||
|
||
.global __memset_chk | ||
.hidden __memset_chk | ||
WEAK(__memset_chk) | ||
.set __memset_chk,memset | ||
|
||
#endif /* UNIX */ | ||
|
||
END_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* ********************************************************** | ||
* Copyright (c) 2014-2020 Google, Inc. All rights reserved. | ||
* ********************************************************** */ | ||
|
||
/* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* * Neither the name of Google, Inc. nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
* DAMAGE. | ||
*/ | ||
|
||
/* | ||
* memfuncs.asm: Contains our custom memcpy and memset routines. | ||
* | ||
* See the long comment at the top of x86/memfuncs.asm. | ||
*/ | ||
|
||
#include "../asm_defines.asm" | ||
START_FILE | ||
|
||
#ifdef UNIX | ||
|
||
/* Private memcpy. | ||
* FIXME i#1551: we should optimize this as it can be on the critical path. | ||
*/ | ||
DECLARE_FUNC(memcpy) | ||
GLOBAL_LABEL(memcpy:) | ||
cmp ARG3, #0 | ||
mov REG_R12/*scratch reg*/, ARG1 | ||
1: beq 2f | ||
ldrb REG_R3, [ARG2] | ||
strb REG_R3, [ARG1] | ||
subs ARG3, ARG3, #1 | ||
add ARG2, ARG2, #1 | ||
add ARG1, ARG1, #1 | ||
b 1b | ||
2: mov REG_R0, REG_R12 | ||
bx lr | ||
END_FUNC(memcpy) | ||
|
||
/* Private memset. | ||
* FIXME i#1551: we should optimize this as it can be on the critical path. | ||
*/ | ||
DECLARE_FUNC(memset) | ||
GLOBAL_LABEL(memset:) | ||
cmp ARG3, #0 | ||
mov REG_R12/*scratch reg*/, ARG1 | ||
1: beq 2f | ||
strb ARG2, [ARG1] | ||
subs ARG3, ARG3, #1 | ||
add ARG1, ARG1, #1 | ||
b 1b | ||
2: mov REG_R0, REG_R12 | ||
bx lr | ||
END_FUNC(memset) | ||
|
||
/* See x86.asm notes about needing these to avoid gcc invoking *_chk */ | ||
.global __memcpy_chk | ||
.hidden __memcpy_chk | ||
WEAK(__memcpy_chk) | ||
.set __memcpy_chk,memcpy | ||
|
||
.global __memset_chk | ||
.hidden __memset_chk | ||
WEAK(__memset_chk) | ||
.set __memset_chk,memset | ||
|
||
#endif /* UNIX */ | ||
|
||
END_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters