I'm testing to make sure that my cross compiler is working. When I compile hello world it seems to compile fine but when I change hello.cpp to the same program that loops 1000 times the elf file generated is exactly the same size. No matter what changes I make the file is always the same size and as far as I can tell, has the same contents. What would cause this?
What does it mean "as far as I can tell"? You can check that with diff
or some other utility. If you're using a cross-compiler to some small device, it might have a reason to allocate the output in blocks of a specified size, or even preallocate the target's device size. Can you verify with some tool that you indeed get exactly the same file?
Without more details, it would be hard to help you much. But here are some ideas:
As Bobby says, are you sure that you're passing the right files to it?
Are you sure that the executable that you're running is the one being generated?
Is the compilation actually succeeding? The executable you're running could be the one from the last successful run of the compiler rather than your current attempts to compile.
As viraptor suggested, are you absolutely sure that the files are the same? Does diff say that they're the same? It's possible that whatever changes you're making are getting optimized out - especially if you're making changes in code that isn't even called.
Really, the odds are that you're not really doing what you think your doing.
Make sure that your compilation commands - be they on the command-line or in a make file or whatever - are correct.
You should probably delete your executable to make sure that a new one is actually being generated.
See what the compiler does if you specifically try and compile junk. It shouldn't compile. If it is, then you're not compiling what you think you're compiling.