Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constructor (priority)
- constructor (priority)
- constructor (priority)
- .ctors :
- {
- /* gcc uses crtbegin.o to find the start of
- the constructors, so we make sure it is
- first. Because this is a wildcard, it
- doesn't matter if the user does not
- actually link against crtbegin.o; the
- linker won't look for a file to match a
- wildcard. The wildcard also means that it
- doesn't matter which directory crtbegin.o
- is in. */
- KEEP (*crtbegin.o(.ctors))
- KEEP (*crtbegin?.o(.ctors))
- /* We don't want to include the .ctor section from
- the crtend.o file until after the sorted ctors.
- The .ctor section from the crtend file contains the
- end of ctors marker and it must be last */
- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
- KEEP (*(SORT(.ctors.*)))
- KEEP (*(.ctors))
- }
- func_ptr *p;
- for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
- (*p) ();
- void dothat() { }
- struct f {
- f() { dothat(); }
- } f_;
- void doit() __attribute__((constructor (0)));
- void doit() { }
- int main() { }
- .ctors 0x080494f4 0x10
- *crtbegin.o(.ctors)
- .ctors 0x080494f4 0x4 /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/crtbegin.o
- *crtbegin?.o(.ctors)
- *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
- .ctors 0x080494f8 0x4 /tmp/ccyzWBjs.o
- *(SORT(.ctors.*))
- .ctors.65535 0x080494fc 0x4 /tmp/ccyzWBjs.o
- *(.ctors)
- .ctors 0x08049500 0x4 /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/crtend.o
- E.g Mixing: int p [] = { 1,2,3 };
- And: extern int * p;
Add Comment
Please, Sign In to add comment