#2698 closed defect (fixed)

GCC 6.1 is broken for microblaze

Reported by: Sebastian Huber Owned by:
Priority: normal Milestone: 5.1
Component: tool/gcc Version: 5
Severity: normal Keywords:
Cc: Blocked By:


The enabled libatomic reveals a bug in the microblaze RTEMS configuration:

configure:3566: checking for C compiler default output file name
configure:3588: /scratch/git-rtems-source-builder/rtems/build/microblaze-rtems4.12-gcc-6.0.1-RC-20160415-newlib-6ee81f44e04848901c7b05c968564d34a7ceed06-x86_64-linux-gnu-1/build/./gcc/xgcc -B/scratch/git-rtems-source-builder/rtems/build/microblaze-rtems4.12-gcc-6.0.1-RC-20160415-newlib-6ee81f44e04848901c7b05c968564d34a7ceed06-x86_64-linux-gnu-1/build/./gcc/ -nostdinc -B/scratch/git-rtems-source-builder/rtems/build/microblaze-rtems4.12-gcc-6.0.1-RC-20160415-newlib-6ee81f44e04848901c7b05c968564d34a7ceed06-x86_64-linux-gnu-1/build/microblaze-rtems4.12/newlib/ -isystem /scratch/git-rtems-source-builder/rtems/build/microblaze-rtems4.12-gcc-6.0.1-RC-20160415-newlib-6ee81f44e04848901c7b05c968564d34a7ceed06-x86_64-linux-gnu-1/build/microblaze-rtems4.12/newlib/targ-include -isystem /scratch/git-rtems-source-builder/rtems/build/microblaze-rtems4.12-gcc-6.0.1-RC-20160415-newlib-6ee81f44e04848901c7b05c968564d34a7ceed06-x86_64-linux-gnu-1/gcc-6.0.1-RC-20160415/newlib/libc/include -B/build/rtems-4.12/microblaze-rtems4.12/bin/ -B/build/rtems-4.12/microblaze-rtems4.12/lib/ -isystem /build/rtems-4.12/microblaze-rtems4.12/include -isystem /build/rtems-4.12/microblaze-rtems4.12/sys-include -g -O2 conftest.c >&5
/build/rtems-4.12/microblaze-rtems4.12/bin/ld: cannot open linker script file xilinx.ld: No such file or directory
collect2: error: ld returned 1 exit status


gcc/config/microblaze/microblaze.h: %{!T*: -dT xilinx.ld%s}"

This should be somehow fixed in the RTEMS GCC configuration for microblaze.

Change History (6)

comment:1 Changed on Apr 21, 2016 at 2:54:47 PM by Joel Sherrill

This is in gcc/config/microblaze/microblaze.h:

/* Extra switches sometimes passed to the linker. */
/* -xl-mode-xmdstub translated to -Zxl-mode-xmdstub -- deprecated. */

#define LINK_SPEC "%{shared:-shared} -N -relax \

%{mbig-endian:-EB --oformat=elf32-microblaze} \
%{mlittle-endian:-EL --oformat=elf32-microblazeel} \
%{Zxl-mode-xmdstub:-defsym _TEXT_START_ADDR=0x800} \
%{mxl-mode-xmdstub:-defsym _TEXT_START_ADDR=0x800} \
%{mxl-gp-opt:%{G*}} %{!mxl-gp-opt: -G 0} \
%{!T*: -dT xilinx.ld%s}"


We can add an undef of LINK_SPEC to gcc/config/microblaze/rtems.h as a minimum. Or we can redefine it to a subset of what it is by default.

Based on the set of libc.a's installed, I think we need at least the endian flags. I would tend to keep the mxl-gp-opt since it looks harmless enough. But I would redefine and drop the xmdstub and xilinx.ld ones (drop 3, keep rest). That results in:

#undef LINK_SPEC
#define LINK_SPEC "%{shared:-shared} -N -relax \

%{mbig-endian:-EB --oformat=elf32-microblaze} \
%{mlittle-endian:-EL --oformat=elf32-microblazeel} \
%{mxl-gp-opt:%{G*}} %{!mxl-gp-opt: -G 0}

How does that look?

comment:2 Changed on Apr 21, 2016 at 3:41:04 PM by Joel Sherrill

I posted a patch which builds but I haven't tested it with RTEMS. Give this a try:


comment:3 Changed on Apr 27, 2016 at 7:08:00 AM by Sebastian Huber

Resolution: fixed
Status: newclosed

comment:4 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber


comment:5 Changed on Oct 10, 2017 at 5:58:26 AM by Sebastian Huber

Component: GCCtool/gcc

comment:6 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber


Milestone renamed

Note: See TracTickets for help on using tickets.