SIGILL occurs before the main() fucntion has even been called!
If you get a SIGILL when starting debugging it can be because one of the libraries is doing a runtime check to see what instructions are supported and they can do it by installing a trap and attempting to execute a possibly illegal instruction. When debugging the debugger picks the illegal instruction up rather than the temporary one that the library installed.
First ensure you've updated+upgraded Linux to make sure everything is up to date, this may well fix it.
If not you can try telling the debugger to ignore it and continue without any problems by giving gdb the following instruction before running the program it will let the program deal with it:
handle SIGILL pass nostop noprint