Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass -fno-builtin to fix build with gcc 10 #9

Closed

Conversation

tpetazzoni
Copy link
Contributor

gcc 10, if it recognizes some hand-written code that looks like
memcpy, will generate a call to memcpy().

For example:

    while (dst < &_end_data) {
            *dst++ = *src++;
    }

gets recognized as such. However, in the context of bare-metal code,
having a call to memcpy() in the C library doesn't work. So we fix
that by disabling builtins.

Fixes:

/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.o: in function reset': stm32f429i-disco.c:(.text.reset+0x1a): undefined reference to memcpy'
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.c:(.text.reset+0x34): undefined reference to `memset'
make[1]: *** [Makefile:26: stm32f429i-disco] Error 1

Signed-off-by: Thomas Petazzoni thomas.petazzoni@bootlin.com

gcc 10, if it recognizes some hand-written code that looks like
memcpy, will generate a call to memcpy().

For example:

        while (dst < &_end_data) {
                *dst++ = *src++;
        }

gets recognized as such. However, in the context of bare-metal code,
having a call to memcpy() in the C library doesn't work. So we fix
that by disabling builtins.

Fixes:

/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.o: in function `reset':
stm32f429i-disco.c:(.text.reset+0x1a): undefined reference to `memcpy'
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.c:(.text.reset+0x34): undefined reference to `memset'
make[1]: *** [Makefile:26: stm32f429i-disco] Error 1

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Copy link

@philmd philmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Philippe Mathieu-Daudé f4bug@amsat.org

tpetazzoni added a commit to tpetazzoni/afboot-stm32 that referenced this pull request Apr 28, 2022
gcc 10, if it recognizes some hand-written code that looks like
memcpy, will generate a call to memcpy().

For example:

        while (dst < &_end_data) {
                *dst++ = *src++;
        }

gets recognized as such. However, in the context of bare-metal code,
having a call to memcpy() in the C library doesn't work. So we fix
that by disabling builtins.

Fixes:

/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.o: in function `reset':
stm32f429i-disco.c:(.text.reset+0x1a): undefined reference to `memcpy'
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.c:(.text.reset+0x34): undefined reference to `memset'
make[1]: *** [Makefile:26: stm32f429i-disco] Error 1

Upstream: mcoquelin-stm32#9
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
@tpetazzoni
Copy link
Contributor Author

Closing, as I've sent another pull request containing both this change and another build fix.

@tpetazzoni tpetazzoni closed this Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants