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: undefined reference to __aeabi_unwind_cpp_pr1, __cxa_end_cleanup


JJ <alchemistmba@gmail.com> writes:

> I have a few questions about the ctors/dtors section. I've defined
> these in my linker script:
>         __ctors = .;
>         .ctors : { *(.ctors) }
>         __dtors = .;
>         .dtors : { *(.dtors) }
>
> When I disassemble my binary, I don't see these labels. Could this be
> because the linker cannot find any .ctors/.dtors sections? I do have
> constructors/destructors defined for my C++ classes.

These symbols are normally in the read-only data section, so it's
normal to not see them when you disassemble.  The .ctors and .dtors
sections are normally not executable code, but instead lists of
addresses of functions to call at global constructor/destructor time.


> I've defined a custom "_start" section in assembly. The existing code
> seems to get the first address out of the ctors section and jumps to
> it. I guess the ctors section contains pointers to the constructor
> functions?

Right.

> Since the binary doesn't contain a ctors/dtors section, the
> execution jumps to the wrong address.

The first entry is normally a zero word.

> Could you point me to some documentation on the ctors and dtors areas?
> I couldn't find any good info online.

I don't think there is any docs on this.  The first word in the
sections normally comes from crtbegin.o or crtend.o, which are
provided by gcc.

Ian


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