Doesn't gcc care about the order the files are passed on the command line? Try fiddling with that.