This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: need help with gcc_except_table


Alan Nilsson <alan.n@mac.com> writes:

> the first was provided by the vendor of the embedded system I am
> working with, the second I built.  They both work fine when creating
> code that links against the vendors non-debug static libs.  However,
> when I link (with the 4.4.2/2.20 combo) against the debug versions
> of the vendor supplied libs, I get several gcc_except_table sections
> at the beginning of the code.  This does not happen with the vendors
> 4.2.1/2.18 setup.  The embedded system must have the start of text
> at 0x020000000, but with the exception entries it gets pushed back
> to around 0x020000A0 so when it loads it traps.

Try using the linker's -Map option to find out where the
.gcc_except_table sections are coming from.


> I was reading Ian Lance Taylor's linking articles on his blog from
> back in 2007, but the info on gcc_except_table was very short.  It
> did imply that there was a optimization that moved the exception
> tables from inline with the text to the beginning of text, or did I
> misunderstand?

I think you misunderstood.  The .gcc_except_table sections need to be
present somewhere in the text segment if you want to do exception
unwinding.  They don't need to be at the front, though.


> The elf file gets converted to s-records before it gets loaded onto
> the embedded system, I could easily enough strip out the exception
> tables and shift the address of everything else so the text starts
> at the correct place, but is this asking for trouble?

It's asking for trouble if your code ever throws an exception.  If
your code does not use exceptions then it should be fine.

Another approach you can use is to use the linker script to move the
.gcc_except_table sections so that they are not at the front.  It
doesn't really matter where they wind up.

Ian


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