This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: "no debugging symbols found" for a freestanding application
- From: Anatol Pomozov <anatol dot pomozov at gmail dot com>
- To: Paul dot Koning at dell dot com, gdb at sourceware dot org
- Date: Mon, 29 Jan 2018 07:46:52 -0800
- Subject: Re: "no debugging symbols found" for a freestanding application
- Authentication-results: sourceware.org; auth=none
- References: <CAOMFOmW-CcOLpM47JXn4_y9mwR+Ba7qr-zi5sa=n6O2PWNKcww@mail.gmail.com> <90E6558B-258A-4D6C-B2F8-0E22DA36C953@dell.com>
Hello Paul
On Mon, Jan 29, 2018 at 6:06 AM, <Paul.Koning@dell.com> wrote:
>
>
>> On Jan 28, 2018, at 10:47 PM, Anatol Pomozov <anatol.pomozov@gmail.com> 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."