https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59710
Sebastian Huber <sebastian.hu...@embedded-brains.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |5.0 --- Comment #3 from Sebastian Huber <sebastian.hu...@embedded-brains.de> --- Thanks, this fixes the problem in case the new -mgpot=global option is used. Do you plan to back port this to GCC 4.9? If not, then can you please adjust the target milestone and close the PR. nios2-elf-gcc -O2 -mgpopt=global -fno-common -S gprel-ok.c && cat gprel-ok.s .file "gprel-ok.c" .section .text .align 2 .global gprel_ok .type gprel_ok, @function gprel_ok: movi r2, 123 stw r2, %gprel(iii)(gp) movi r2, 789 stw r2, %gprel(jjj)(gp) ret .size gprel_ok, .-gprel_ok .global jjj .section .sdata,"aws",@progbits .align 2 .type jjj, @object .size jjj, 4 jjj: .long 456 .global iii .section .sbss,"aws",@nobits .align 2 .type iii, @object .size iii, 4 iii: .zero 4 .ident "GCC: (GNU) 5.0.0 20150116 (experimental)" nios2-elf-gcc -O2 -mgpopt=global -fno-common -S gprel-not-ok.c && cat gprel-not-ok.s .file "gprel-not-ok.c" .section .text .align 2 .global gprel_not_ok .type gprel_not_ok, @function gprel_not_ok: movi r2, 123 stw r2, %gprel(iii)(gp) movi r2, 789 stw r2, %gprel(jjj)(gp) ret .size gprel_not_ok, .-gprel_not_ok .ident "GCC: (GNU) 5.0.0 20150116 (experimental)"