This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "no debugging symbols found" for a freestanding application


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."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]