I recommend creating a different name for your own memcpy() implementation, and use that. You may also make it configurable which implementation to use.
On Thu, Apr 17, 2025, 08:51 Wasim Khan via Gcc-help <gcc-h...@gcc.gnu.org> wrote: > Hi, > > I have a custom implementation of memcpy() function and don't want to use > implementation provided by libc.a. > Things works fine with toolchain version 12.3 and my local implementation > in utils.c is considered. > But when I move to toolchain version 14.2 , I am getting below error. > > > Linking ... > /opt/arm-gnu-toolchain-*-aarch64-none-elf/bin/aarch64-none-elf-gcc \ > -nodefaultlibs \ > -nostartfiles \ > -mcpu=cortex-a55 \ > -Wl,--gc-sections \ > -Wl,--build-id=none \ > -T /opt/test.lds \ > -Wl,-Map=/opt/test.map \ > -Wl,--no-warn-rwx-segments \ > /opt/test.o /opt/utils.o \ > -L /opt/arm-gnu-toolchain-*-aarch64-none-elf/aarch64-none-elf/lib \ > -Wl,--start-group -l:libc.a -l:libgcc.a -Wl,--end-group \ > -o /opt/test.elf > > /opt/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/14.2.1/../../../../aarch64-none-elf/bin/ld: > /opt/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-elf/aarch64-none-elf/lib/libc.a(libc_a-memcpy.o): > in function `memcpy': > /data/jenkins/workspace/GNU-toolchain/arm-14/src/newlib-cygwin/newlib/libc/machine/aarch64/memcpy.S:60: > multiple definition of `memcpy'; /opt/utils.o:/opt/utils.c:247: first > defined here > collect2: error: ld returned 1 exit status > make: *** [Makefile:282: linkobj] Error 1 > > > > Need help on how to use custom implementation of memcpy() (but use all > other standard functions from libc.a). > Also, any idea on why the issue is with 14.2 and not with earlier versions > (like 12.3) ? > > Regards, > >