public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104324] New: v850-elf-as regression: displacement is too large
@ 2022-02-01 13:56 gcc-v850-bugs at engineer dot com
  2022-02-01 14:11 ` [Bug target/104324] " gcc-v850-bugs at engineer dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc-v850-bugs at engineer dot com @ 2022-02-01 13:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104324

            Bug ID: 104324
           Summary: v850-elf-as regression: displacement is too large
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-v850-bugs at engineer dot com
  Target Milestone: ---

The following minimum example fails to assemble in "newer" gcc versions. In
4.9.2 (prebuilt and retrieved from here
https://llvm-gcc-renesas.com/v850/v850-download-toolchains/) all targets listed
below works, but in 10.3 and 11.2 only later targets works, see below. The 10.3
and 11.2 are built from source from a Dockerfile as listed later on. I fail to
build older versions of gcc myself due to various compilation issues, didn't
investigate those further. Would love to git bisect this issue, but can't since
I fail to build old enough gcc's.

file.S:

    _RESET:
      mov 0x37, r15
      st.b r15, 0xfffff06e[zero]

    -- Works in 4.9.2, fails in (at least) 10.3 and 11.2:
    -- $ v850-elf-as -mv850 -c file.S
    -- $ v850-elf-as -mv850e -c file.S
    -- $ v850-elf-as -mv850e1 -c file.S
    -- $ v850-elf-as -mv850es -c file.S
    -- Works in 4.9.2, 10.3, 11.2:
    -- $ v850-elf-as -mv850e2 -c file.S
    -- $ v850-elf-as -mv850e2v3 -c file.S
    -- $ v850-elf-as -mv850e2v4 -c file.S
    -- $ v850-elf-as -mv850e3v5 -c file.S

Dockerfile:

    ARG TARGET_ARCH="v850-elf"
    ARG TOOLCHAIN_VERSION="master"
    ARG TOOLCHAIN_NAME="gcc-${TARGET_ARCH}-${TOOLCHAIN_VERSION}"
    ARG TOOLCHAIN_PATH="/opt/${TOOLCHAIN_NAME}"

    FROM debian:10 as build
    ARG DEBIAN_FRONTEND=noninteractive

    ARG TARGET_ARCH
    ARG TOOLCHAIN_VERSION
    ARG TOOLCHAIN_NAME
    ARG TOOLCHAIN_PATH

    ENV PATH="${TOOLCHAIN_PATH}/bin:${PATH}"

    ENV DEBIAN_FRONTEND=noninteractive
    RUN apt-get -y update && \
        apt-get -y install --no-install-recommends \
        build-essential \
        texinfo \
        wget \
        && rm -rf /var/lib/apt/lists/*

    ENV DOWNLOAD_PATH="/tmp/${TOOLCHAIN_NAME}/download" \
        SOURCES_PATH="/tmp/${TOOLCHAIN_NAME}/sources" \
        BUILD_PATH="/tmp/${TOOLCHAIN_NAME}/build"

    ENV BINUTILS_VERSION="2.36.1" \
        GCC_VERSION="11.2.0" \
        GMP_VERSION="6.2.1" \
        MPC_VERSION="1.2.1" \
        MPFR_VERSION="4.1.0" \
        GDB_VERSION="10.2" \
        NEWLIB_VERSION="4.1.0"

    RUN wget --tries=10 --continue --no-check-certificate --no-verbose \
        https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.gz \
       
https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.gz \
        https://ftp.gnu.org/gnu/gmp/gmp-${GMP_VERSION}.tar.bz2 \
        https://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz \
        https://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.gz \
        https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.gz \
        ftp://sourceware.org/pub/newlib/newlib-${NEWLIB_VERSION}.tar.gz \
        -P ${DOWNLOAD_PATH}

    RUN mkdir -p ${SOURCES_PATH} && \
        for f in ${DOWNLOAD_PATH}/*.tar.gz; \
        do \
        tar xf "$f" -C ${SOURCES_PATH}; \
        done; \
        for f in ${DOWNLOAD_PATH}/*.tar.bz2; \
        do \
        tar xjf "$f" -C ${SOURCES_PATH}; \
        done

    RUN cd ${SOURCES_PATH}/gcc-${GCC_VERSION} && \
        ln -s ../gmp-${GMP_VERSION} gmp && \
        ln -s ../mpc-${MPC_VERSION} mpc && \
        ln -s ../mpfr-${MPFR_VERSION} mpfr

    # build binutils
    RUN mkdir -p ${BUILD_PATH}/binutils && \
        cd ${BUILD_PATH}/binutils && \
        ${SOURCES_PATH}/binutils-${BINUTILS_VERSION}/configure \
        --target=${TARGET_ARCH} \
        --prefix=${TOOLCHAIN_PATH} \
        --disable-nls \
        && \
        make -j$(nproc) all && \
        make install

    ENV GCC_OPTS=" \
        --with-gnu-as \
        --with-gnu-ld \
        --disable-shared \
        --disable-libssp \
        --disable-threads \
        --disable-nls \
        --with-newlib \
        "

    # build gcc - 1st pass
    RUN mkdir -p ${BUILD_PATH}/gcc && \
        cd ${BUILD_PATH}/gcc && \
        ${SOURCES_PATH}/gcc-${GCC_VERSION}/configure \
        --target=${TARGET_ARCH} \
        --prefix=${TOOLCHAIN_PATH} \
        --enable-languages=c \
        --without-headers \
        ${GCC_OPTS} \
        && \
        make -j$(nproc) all-gcc && \
        make install-gcc



    # build newlib

    RUN mkdir -p ${BUILD_PATH}/newlib && \
        cd ${BUILD_PATH}/newlib && \
        export CFLAGS_FOR_TARGET="-Os -fcommon" && \
        ${SOURCES_PATH}/newlib-${NEWLIB_VERSION}/configure \
        --target=${TARGET_ARCH} \
        --prefix=${TOOLCHAIN_PATH} \
        --enable-newlib-nano-formatted-io \
        --disable-nls \
        && \
        make -j$(nproc) all && \
        make install

    # build gcc - 2nd pass
    RUN cd ${BUILD_PATH}/gcc && \
        ${SOURCES_PATH}/gcc-${GCC_VERSION}/configure \
        --target=${TARGET_ARCH} \
        --prefix=${TOOLCHAIN_PATH} \
        --enable-languages=c,c++ \
        ${GCC_OPTS} \
        && \
        make -j$(nproc) all && \
        make install-strip

    # build gdb
    RUN mkdir -p ${BUILD_PATH}/gdb && \
        cd ${BUILD_PATH}/gdb &&\
        ${SOURCES_PATH}/gdb-${GDB_VERSION}/configure \
        --target=${TARGET_ARCH} \
        --prefix=${TOOLCHAIN_PATH} \
        --disable-nls \
        && \
        make -j$(nproc) all && \
        make install

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/104324] v850-elf-as regression: displacement is too large
  2022-02-01 13:56 [Bug target/104324] New: v850-elf-as regression: displacement is too large gcc-v850-bugs at engineer dot com
@ 2022-02-01 14:11 ` gcc-v850-bugs at engineer dot com
  2022-02-01 19:17 ` pinskia at gcc dot gnu.org
  2022-02-02  8:56 ` gcc-v850-bugs at engineer dot com
  2 siblings, 0 replies; 4+ messages in thread
From: gcc-v850-bugs at engineer dot com @ 2022-02-01 14:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104324

--- Comment #1 from gcc-v850-bugs at engineer dot com ---
The complete error messages (omitted -mv850es since "Error: unrecognized option
-mv850es", included it erroneously above due to "This is an alias for the
-mv850e1 option."). Also, v850 doesn't work either due to the mov 0x37, r15, so
ignore what I wrote above. The issue is "displacement is too large" with v850e:

4.9.2 toolchain:

    $ v850-elf-as --version
    GNU assembler (GNU Binutils) 2.24
    Copyright 2013 Free Software Foundation, Inc.
    This program is free software; you may redistribute it under the terms of
    the GNU General Public License version 3 or later.
    This program has absolutely no warranty.
    This assembler was configured for a target of `v850-elf'

    $ v850-elf-as -mv850e -c file.S
    $ v850-elf-as -mv850e1 -c file.S
    $ v850-elf-as -mv850e2v3 -c file.S
    $ v850-elf-as -mv850e2v4 -c file.S
    $ v850-elf-as -mv850e3v5 -c file.S


11.2.0 toolchain:

    $ v850-elf-as --version
    GNU assembler (GNU Binutils) 2.36.1
    Copyright (C) 2021 Free Software Foundation, Inc.
    This program is free software; you may redistribute it under the terms of
    the GNU General Public License version 3 or later.
    This program has absolutely no warranty.
    This assembler was configured for a target of `v850-elf'.

    $ v850-elf-as -mv850e -c file.S
    file.S: Assembler messages:
    file.S:3: Error: st.b r15,0xfffff06e[zero]: displacement is too large
    $ v850-elf-as -mv850e1 -c file.S
    file.S: Assembler messages:
    file.S:3: Error: st.b r15,0xfffff06e[zero]: displacement is too large
    $ v850-elf-as -mv850e2v3 -c file.S
    $ v850-elf-as -mv850e2v4 -c file.S
    $ v850-elf-as -mv850e3v5 -c file.S

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/104324] v850-elf-as regression: displacement is too large
  2022-02-01 13:56 [Bug target/104324] New: v850-elf-as regression: displacement is too large gcc-v850-bugs at engineer dot com
  2022-02-01 14:11 ` [Bug target/104324] " gcc-v850-bugs at engineer dot com
@ 2022-02-01 19:17 ` pinskia at gcc dot gnu.org
  2022-02-02  8:56 ` gcc-v850-bugs at engineer dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-01 19:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104324

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |MOVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is not a GCC bug, this is a binutils bug (if at all) as the code you wrote
is pure assembler and binutils is where the assembler comes from , please
report it to binutils project: https://sourceware.org/bugzilla/ .

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/104324] v850-elf-as regression: displacement is too large
  2022-02-01 13:56 [Bug target/104324] New: v850-elf-as regression: displacement is too large gcc-v850-bugs at engineer dot com
  2022-02-01 14:11 ` [Bug target/104324] " gcc-v850-bugs at engineer dot com
  2022-02-01 19:17 ` pinskia at gcc dot gnu.org
@ 2022-02-02  8:56 ` gcc-v850-bugs at engineer dot com
  2 siblings, 0 replies; 4+ messages in thread
From: gcc-v850-bugs at engineer dot com @ 2022-02-02  8:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104324

--- Comment #3 from gcc-v850-bugs at engineer dot com ---
Thanks for the response! I just managed to build gcc 4.9.2 (using binutils
2.25) and the issue is still present, which is obvious with your input. I will
look in the binutils direction instead! Thanks again.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-02  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 13:56 [Bug target/104324] New: v850-elf-as regression: displacement is too large gcc-v850-bugs at engineer dot com
2022-02-01 14:11 ` [Bug target/104324] " gcc-v850-bugs at engineer dot com
2022-02-01 19:17 ` pinskia at gcc dot gnu.org
2022-02-02  8:56 ` gcc-v850-bugs at engineer dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).