When building the fxload program (see http://sourceforge.net/projects/linux-hotplug/files/fxload/2008_10_13/) with gcc 4.9.1, binutils 2.24, on the Microblaze EL architecture, the build fails with: /home/buildroot/instance-1/output/host/usr/bin/microblazeel-buildroot-linux-gnu-gcc -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -Os -g2 main.c -o main.o {standard input}: Assembler messages: {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space make[1]: *** [main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... {standard input}: Assembler messages: {standard input}:6463: Error: operation combines symbols in different segments {standard input}:6464: Error: operation combines symbols in different segments {standard input}:6467: Error: operation combines symbols in different segments {standard input}:6468: Error: operation combines symbols in different segments {standard input}:6477: Error: operation combines symbols in different segments {standard input}:6478: Error: operation combines symbols in different segments {standard input}:6481: Error: operation combines symbols in different segments {standard input}:6482: Error: operation combines symbols in different segments {standard input}:6488: Error: operation combines symbols in different segments {standard input}:6489: Error: operation combines symbols in different segments {standard input}:6492: Error: operation combines symbols in different segments {standard input}:6493: Error: operation combines symbols in different segments {standard input}:6502: Error: operation combines symbols in different segments {standard input}:6503: Error: operation combines symbols in different segments {standard input}:6509: Error: operation combines symbols in different segments make[1]: *** [ezusb.o] Error 1 The logerror() function does not seem to have anything really special. It is defined in main.c: void logerror(const char *format, ...) __attribute__ ((format (__printf__, 1, 2))); void logerror(const char *format, ...) { va_list ap; va_start(ap, format); if(dosyslog) vsyslog(LOG_ERR, format, ap); else vfprintf(stderr, format, ap); va_end(ap); } And used from both main.o and ezusb.o, with ezusb.c carrying this definition: extern void logerror(const char *format, ...) __attribute__ ((format (printf, 1, 2))); I will reproduce the problem and attach the assembler file triggering the issue.
Created attachment 7767 [details] main.S Here is the assembly file that triggers the following message: {standard input}: Assembler messages: {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space {standard input}: Error: PC relative branch to label logerror which is not in the instruction space make[2]: *** [main.o] Error 1
Created attachment 7768 [details] ezusb.S Here is the file that triggers the following error: {standard input}: Assembler messages: {standard input}:6463: Error: operation combines symbols in different segments {standard input}:6464: Error: operation combines symbols in different segments {standard input}:6467: Error: operation combines symbols in different segments {standard input}:6468: Error: operation combines symbols in different segments {standard input}:6477: Error: operation combines symbols in different segments {standard input}:6478: Error: operation combines symbols in different segments {standard input}:6481: Error: operation combines symbols in different segments {standard input}:6482: Error: operation combines symbols in different segments {standard input}:6488: Error: operation combines symbols in different segments {standard input}:6489: Error: operation combines symbols in different segments {standard input}:6492: Error: operation combines symbols in different segments {standard input}:6493: Error: operation combines symbols in different segments {standard input}:6502: Error: operation combines symbols in different segments {standard input}:6503: Error: operation combines symbols in different segments {standard input}:6509: Error: operation combines symbols in different segments {standard input}:6510: Error: operation combines symbols in different segments {standard input}:6516: Error: operation combines symbols in different segments {standard input}:6517: Error: operation combines symbols in different segments {standard input}:6520: Error: operation combines symbols in different segments {standard input}:6521: Error: operation combines symbols in different segments {standard input}:6527: Error: operation combines symbols in different segments {standard input}:6528: Error: operation combines symbols in different segments {standard input}:6531: Error: operation combines symbols in different segments {standard input}:6532: Error: operation combines symbols in different segments {standard input}:6541: Error: operation combines symbols in different segments {standard input}:6542: Error: operation combines symbols in different segments {standard input}:6548: Error: operation combines symbols in different segments {standard input}:6549: Error: operation combines symbols in different segments make[2]: *** [ezusb.o] Error 1
Additional insights: * Compiling with -Os -g2 (original test) : fails * Compiling with just -Os : works * Compiling with just -g2 : works * Compiling with -O2 -g2 : fails * Compiling with -O2 : works Summary: it's the combination of an optimization flag (-O) with debugging symbols (-g) that fails. So, after all, maybe it's more a gcc issue than a binutils issue?
Hi Thomas, > Summary: it's the combination of an optimization flag (-O) with debugging > symbols (-g) that fails. > > So, after all, maybe it's more a gcc issue than a binutils issue? Almost certainly. The bug is probably that gcc is generating a short version of a branch instruction (on instruction sequence) when it should be producing a long version instead. Probably because it has incorrectly calculated the lengths of the instructions between the source and destination of the branch. Cheers Nick
Thanks, I've reported the issue to gcc at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261.