https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70120
Bug ID: 70120 Summary: [aarch64] -mno-pc-relative-literal-loads -g causes Assembler messages: Error: unaligned opcodes detected in executable segment Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: assemble-failure Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Target: aarch64-unknown-linux-gnu Created attachment 37885 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37885&action=edit reduced testcase Compiler output: $ aarch64-unknown-linux-gnu-gcc -Og -fschedule-insns -mno-pc-relative-literal-loads -g testcase.c /tmp/ccGjqX1U.s: Assembler messages: /tmp/ccGjqX1U.s: Error: unaligned opcodes detected in executable segment $ aarch64-unknown-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-234020-checking-yes-rtl-df-nographite-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/6.0.0/lto-wrapper Target: aarch64-unknown-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-checking=yes,rtl,df --without-cloog --without-ppl --without-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu --with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld --with-as=/usr/bin/aarch64-unknown-linux-gnu-as --with-sysroot=/usr/aarch64-unknown-linux-gnu --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-234020-checking-yes-rtl-df-nographite-aarch64 Thread model: posix gcc version 6.0.0 20160307 (experimental) (GCC) There are two ways to fix the assembly. 1) align the data: @@ -279,6 +279,7 @@ .align 1 .LC3: .hword 0 + .hword 0 .Letext0: .section .debug_info,"",@progbits .Ldebug_info0: 2) place the data in .rodata: @@ -276,9 +276,11 @@ .hword 0 .hword 0 .hword 0 + .section .rodata .align 1 .LC3: .hword 0 + .text .Letext0: .section .debug_info,"",@progbits .Ldebug_info0: