Cross compiler issue: no .eh_frame_hdr table will be created

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
bradhe
Posts: 5
Joined: Tue Mar 20, 2012 2:24 am

Cross compiler issue: no .eh_frame_hdr table will be created

Post by bradhe »

Hey all,

I'm working on building & running the bare bones example via the cross compiler toolchain configured to target i586. I'm getting the following error and warning, and I'm kind of at the end of my rope on deducing what's going on! Any suggestions welcome.

Relevant output. Am I screwing up the GCC invocation?

Code: Select all

brad@h54:/www/dumbos [master*] $ make
rm -rf bin
rm -rf obj/*.o
mkdir bin
nasm -s -f elf -o obj/loader.o src/loader.s
/usr/local/cross/bin/i586-elf-gcc src/kmain.c src/video.c -o obj/kernel.o -Wall -Wextra -Werror -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
/usr/local/cross/lib/gcc/i586-elf/4.6.3/../../../../i586-elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000008048054
/usr/local/cross/bin/i586-elf-ld -T src/linker.ld -o bin/kernel.bin obj/loader.o obj/kernel.o
/usr/local/cross/bin/i586-elf-ld: error in obj/kernel.o(.eh_frame); no .eh_frame_hdr table will be created.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by JamesM »

Hi,

Can guess that you're coding in C++? It looks like your kernel.o object has been compiled with exceptions enabled, but your linker script tells the linker to discard the exception table. Hence why it's warning you.

Compile with -fno-exceptions (and -fno-rtti).
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by Solar »

Your call:

Code: Select all

/usr/local/cross/bin/i586-elf-gcc src/kmain.c src/video.c -o obj/kernel.o -Wall -Wextra -Werror -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
Call from the tutorial:

Code: Select all

i586-elf-gcc -o kernel.o -c kernel.c -Wall -Wextra -Werror -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
Find the command line option that the tutorial stated but is not present in your code. If necessary, look up its meaning in the compiler manual. It should be obvious from there.

PS: Regarding the issue JamesM pointed out, be notified that there is a separate C++ Bare Bones. (I didn't look beyond the first error out of habit.)
Every good solution is obvious once you've found it.
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by xenos »

Wait a second... How does C++ come into the game? I know that .eh_frame smells like C++, but I really wonder where this comes from. All that I can see is a bit of assembly and pure C (gcc is called on a .c file - there is neither an invocation of g++, nor any .cpp here). And if the OP indeed followed the bare bones tutorial, there should be no C++ in his source files either. I'm surprised how ld comes up with a warning related to exception handling...
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
bradhe
Posts: 5
Joined: Tue Mar 20, 2012 2:24 am

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by bradhe »

Find the command line option that the tutorial stated but is not present in your code. If necessary, look up its meaning in the compiler manual. It should be obvious from there.

PS: Regarding the issue JamesM pointed out, be notified that there is a separate C++ Bare Bones. (I didn't look beyond the first error out of habit.)
Thanks for the prompt reply guys. I was trying to get GCC to spit out one obj file, and then link that obj file with The obj produced by nasm via ld. What is standard practice for that? Multiple obj files?
bradhe
Posts: 5
Joined: Tue Mar 20, 2012 2:24 am

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by bradhe »

XenOS wrote:Wait a second... How does C++ come into the game? I know that .eh_frame smells like C++, but I really wonder where this comes from. All that I can see is a bit of assembly and pure C (gcc is called on a .c file - there is neither an invocation of g++, nor any .cpp here). And if the OP indeed followed the bare bones tutorial, there should be no C++ in his source files either. I'm surprised how ld comes up with a warning related to exception handling...
Oh yeah, no C++ here, by the way...
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by Combuster »

Multiple obj files?
Yes.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by Solar »

bradhe wrote:I was trying to get GCC to spit out one obj file...
1) Don't. Call GCC seperate for each translation unit (.c file).

2) Use "-c" to get an object file. By omitting that option, you're telling GCC to generate an executable...
Every good solution is obvious once you've found it.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by gerryg400 »

You can get this error if your GCC is not built correctly. I'm not sure about the cross-compiler in the tutorial but for a long time I had this issue. Eventually modifying this line in my config.gcc solved it. My recollection is that it applies mainly to 64 bit cross-compilers. I'm not suggesting that it's your problem but offer it here in case others are looking for a solution.

Code: Select all

+	tmake_file="${tmake_file} i386/t-i386elf t-svr4 i386/t-crtstuff"
Adding the i386/t-crtstuff was the solution.
If a trainstation is where trains stop, what is a workstation ?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by Solar »

Check this GCC ticket regarding the meaning of t-crtstuff.
Every good solution is obvious once you've found it.
User avatar
brain
Member
Member
Posts: 234
Joined: Thu Nov 05, 2009 5:04 pm
Location: UK
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by brain »

When I've had this issue in the past (undefined symbol _start) I've managed to get around it with the gcc -freestanding flag. note, this is kind of unrelated to the eh_frame errors.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by gerryg400 »

Solar wrote:Check this GCC ticket regarding the meaning of t-crtstuff.
That's the one.
If a trainstation is where trains stop, what is a workstation ?
User avatar
Jezze
Member
Member
Posts: 395
Joined: Thu Jul 26, 2007 1:53 am
Libera.chat IRC: jfu
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by Jezze »

I had this issue as well. I thought it was because I built gcc using --enable-languages=c and that made it complain about missing eh_frame.

EDIT: Sorry not same error.
Fudge - Simplicity, clarity and speed.
http://github.com/Jezze/fudge/
invalid
Member
Member
Posts: 60
Joined: Thu Feb 23, 2012 8:39 am

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by invalid »

I'm confused after what I've read here. My cross-compiler has only C enabled, but it generates eh_frame sections anyway (discarded by linker). Is this wrong?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Cross compiler issue: no .eh_frame_hdr table will be cre

Post by JamesM »

XenOS wrote:Wait a second... How does C++ come into the game? I know that .eh_frame smells like C++, but I really wonder where this comes from. All that I can see is a bit of assembly and pure C (gcc is called on a .c file - there is neither an invocation of g++, nor any .cpp here). And if the OP indeed followed the bare bones tutorial, there should be no C++ in his source files either. I'm surprised how ld comes up with a warning related to exception handling...
Interestingly, I thought the gcc compiler driver could compile .c files as C++ without -x c++ - I was wrong, apparently it requires -x c++.

I didn't notice the lack of "-c" on his command line, and that made me think gcc was compiling kernel.c as C++.
Post Reply