On 03/03/2022 13:41, Dongjiu Geng via Gcc wrote:
Hi,
      My program does not use CRC instructions,but I find the compiled
binary has much difference between using "-march=armv8-a+crc" and
using "-march=armv8-a". Even stranger, when I use
"-march=armv8-a+crc", I find my compiled binary can not run. but when
I change -O2 to -O0 based on "-march=armv8-a+crc",  it can run. I  do
not  know what is the reason.. can you answer it? Thanks.

The most common reason for a program failing to run when the optimizer is turned on is that it contains undefined behaviour. Make sure that you turn on GCC's warning options and fix anything that these report.

It's very unlikely that the change of -march=armv8-a to -march=armv8-a+crc is the reason for the differences in compiled code that you are seeing. Something else to try here is to identify an object file that is different between the two options and then rebuild it both ways, but add "-g". You can then use

  readelf -debug-dump=str <object-file>

to print out the real options used by the compiler (there may be some additional strings reported in the dump, but the options are the bit that is interesting). The only difference should be the -march option you mentioned above.

R.

Reply via email to