[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for
From: |
gabemarcano at yahoo dot com |
Subject: |
[Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi |
Date: |
Sat, 29 May 2021 09:34:03 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27833
Gabriel Marcano <gabemarcano at yahoo dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gabemarcano at yahoo dot com
--- Comment #6 from Gabriel Marcano <gabemarcano at yahoo dot com> ---
I think I'm also running into the same problem, although outside the context of
the ld unit tests (I think this is the same bug, but if you don't think so I
can open a separate report).
I have an arm-none-eabi-gcc version 11.1.0 compiler with newlib 4.1.0, with
binutils 2.36.1 that is unable to link when lto is enabled when pulling in
symbols from newlib, but links fine without lto. Specifically, what prevents
linking from completing is a whole bunch of undefined references referring to
libc.a symbols that, as far as I can tell via nm, are there (plus, again,
everything links without lto).
I've been trying to figure out what's going on on a thread in the gcc-help
mailing list. I was able to come up with a simple example reproducing the
problem (https://gcc.gnu.org/pipermail/gcc-help/2021-May/140346.html), which
I'll copy here for convenience:
main.c:
#include <string.h>
int f();
int main() {
return f();
}
void _exit(int v)
{
for(;;);
}
void *_sbrk(int incr) {
return NULL;
}
t1.c:
#include <stdlib.h>
int f() { return (int)malloc(0x0);}
With commands:
arm-none-eabi-gcc -O -flto -g -c -o main.o main.c
arm-none-eabi-gcc -O0 -flto -g -c -o t1.o t1.c
arm-none-eabi-gcc -O -flto -g main.o t1.o -o main
If I try building the example, I get an undefined reference to malloc. I first
noticed this while trying to build another application for ARM, and ended up
with a whole bunch more undefined references to functions like strncpy, memcpy,
malloc, free, and so on.
One thing we noticed/noted is that linking appears to succeed if we pass the
flag -fno-builtin-malloc when compiling the t1.c file.
Let me know if you need more information from me, or whether I should open a
separate bug report.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/27833] New: ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi, dimitar at dinux dot eu, 2021/05/08
- [Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi, dimitar at dinux dot eu, 2021/05/08
- [Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi, dimitar at dinux dot eu, 2021/05/08
- [Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi, nickc at redhat dot com, 2021/05/19
- [Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi, dimitar at dinux dot eu, 2021/05/24
- [Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi, nickc at redhat dot com, 2021/05/25
- [Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi, dimitar at dinux dot eu, 2021/05/26
- [Bug ld/27833] ld-plugin/pr24406-1.c fails with GCC cross-toolchain for arm-none-eabi,
gabemarcano at yahoo dot com <=