dl06 fails to build for RISC-V (griscv bsp)

Hesham Almatary hesham.almatary at cl.cam.ac.uk
Tue Sep 8 08:32:02 UTC 2020


On Mon, 7 Sep 2020 at 09:01, Jiri Gaisler <jiri at gaisler.se> wrote:
>
>
> On 9/7/20 10:44 AM, Hesham Almatary wrote:
> > I have only made sure rap builds when I added libdl support for
> > RISC-V. But I haven't tested it on run-time, only ELF objects. It's
> > likely to have been failing in run-time all along. Also, there are a
> > few relocations still to be implemented for ELF like PCREL_LO12_X and
> > RELAX. I got around that by passing -mno-relax
>
> Very interesting! I applied -mno-relax when building dl06, and the error then changed to:
>
> error: rap::object: Section index '0' not found: /home/jiri/src/rtems/6/bin/../lib/gcc/riscv-rtems6/10.2.1/../../../../riscv-rtems6/lib/rv32imafd/ilp32d/libm.a:lib_a-e_atan2.o at 709534
>
> Does this indicate that newlib must be build with -mno-relax? If so, maybe we should disable the dlxx tests for RISC-V ..?
>
I don't think so. Only the to-be-loaded object needs -mno-relax as
libdl ignores the RELAX relocations, but GCC does handle it.
AFAIK, relaxation only affects performance by trying to be smart
emitting one instruction (with an immediate) instead of two
instructions that construct a full reg-size value (in a register). It
shouldn't affect the functional behaviour if we ignore it, as we will
be just taking the slowpath of handling two instructions instead of
trying to relax them to just one. LLVM/LLD, for example, hasn't
implemented it until a few months ago. More information here:
https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Options.html
https://www.sifive.com/blog/all-aboard-part-3-linker-relaxation-in-riscv-toolchain

>
> >
> > On Sun, 6 Sep 2020 at 19:50, Jiri Gaisler <jiri at gaisler.se> wrote:
> >> I re-applied your patch and dl06 builds again, but the dl06.exe program fails. I have updated the ticket:
> >>
> >> https://devel.rtems.org/ticket/4069#no2
> >>
> >>
> >> On 9/6/20 10:12 AM, Hesham Almatary wrote:
> >>> That's the same as [1]. I've seen that error before and (thought I)
> >>> fixed it [2], but not sure what has changed since then.
> >>>
> >>> [1] https://lists.rtems.org/pipermail/devel/2020-August/061717.html
> >>> [2] https://github.com/RTEMS/rtems-tools/commit/e6e610d262940b7651157597b6b1406aa806b4d1
> >>>
> >>> On Sun, 6 Sep 2020 at 09:14, Chris Johns <chrisj at rtems.org> wrote:
> >>>> On 6/9/20 6:32 am, Jiri Gaisler wrote:
> >>>>> I have updated both RTEMS and RSB to git head, and dl06 now fails to build:
> >>>>>
> >>>>> riscv-rtems6-g++ -march=rv32imafd -mabi=ilp32d -O2 -g -ffunction-sections -fdata-sections -Wall      -Wl,--gc-sections  -march=rv32imafd -mabi=ilp32d  -B./../../lib/libbsp/riscv/griscv -B/home/jiri/ibm/src/rtems/rtems/bsps/riscv/griscv/start -specs bsp_specs -qrtems -L./../../cpukit -L/home/jiri/ibm/src/rtems/rtems/bsps/riscv/shared/start -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar -o dl05.exe dl05/dl05-init.o dl05/dl05-dl-load.o dl05/dl05-dl-cpp.o dl05-dl05-tar.o ../../lib/libbsp/riscv/griscv/librtemsbsp.a ../../cpukit/librtemscpu.a ../../cpukit/librtemstest.a dl05-sym.o
> >>>> This is dl05 and I do not think it is related to the issue.
> >>>>
> >>>>> rtems-ld -r /home/jiri/src/rtems/riscvmp/riscv-rtems6/c/griscv \
> >>>>>   -C riscv-rtems6-gcc -c "-march=rv32imafd -mabi=ilp32d" \
> >>>>>   -O rap -b dl06.pre -e rtems_main -s \
> >>>>>   -o dl06.rap dl06-o1.o dl06-o2.o -lm
> >>>>> error: rap::object: Section index '0' not found: dl06-o1.o
> >>>>> Makefile:8528: recipe for target 'dl06.rap' failed
> >>>>> make[5]: *** [dl06.rap] Error 10
> >>>> This looks like something in rtems-ld in the rtems-tools.git repo.
> >>>>
> >>>>> It seems like dl06-o1.o not built but a link is attempted - is dl06 supposed to be enabled or disabled for RISC-V ?
> >>>> Enabled but it seems something has changed to cause the test to not link. I
> >>>> wonder if a tool upgrade is the reason. I have raised ..
> >>>>
> >>>> https://devel.rtems.org/ticket/4069
> >>>>
> >>>> Chris
> >>>> _______________________________________________
> >>>> devel mailing list
> >>>> devel at rtems.org
> >>>> http://lists.rtems.org/mailman/listinfo/devel
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list