Re: "no debugging symbols found" for a freestanding application
Anatol Pomozov <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAOMFOmWsMvF9cWMvTZ4=RBpDh9zXDUit02d7d_8k+pFd-Xp58g@mail.gmail.com> |
Hello Paul On Mon, Jan 29, 2018 at 6:06 AM, <[email protected]> wrote: > > >> On Jan 28, 2018, at 10:47 PM, Anatol Pomozov <[email protected]> wrote: >> >> Hello >> >> I am trying to build a freestanding statically linked x86_64 binary. I >> have LinkTimeOptimization enabled. >> >> Here is example of *.c compilation command line I use: >> >> gcc -g -ggdb -flto -nostdlib -ffreestanding -std=c11 >> -fno-stack-protector -mno-red-zone -fomit-frame-pointer >> -fno-math-errno -fno-trapping-math -fno-common -fno-PIC -fno-PIE >> -static -W -Wall -Wextra -O3 -mtune=native -MMD -MQ foo.o -MF foo.o.d >> -c foo.c -o foo.o >> >> >> And here is the linked command line: >> >> gcc -Wl,--build-id -Wl,-n -Wl,-Tlinker.ld -flto -nostdlib >> -ffreestanding -fno-stack-protector -mno-red-zone -fomit-frame-pointer >> -fno-math-errno -fno-trapping-math -fno-common -fno-PIC -fno-PIE >> -static foo.o -o foo.elf >> >> I enabled debug symbols using -g flag and see that ELF section is generated. > > There is no -g in your link command. I tried it and it neither helps. Also according to "man ld" flag -g is ignored: " -g Ignored. Provided for compatibility with other tools."