Skip to contentSkip to conversation

platform/kendryte: disable FW_PIC

RFC New Heinrich Schuchardt 4 participants 7 messages Sep 4, 2021

lore
Share & tools
lore
#0 lore raw

RFC 1/1 platform/kendryte: disable FW_PIC

Since commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default") building with

make \
PLATFORM=kendryte/k210 \
FW_PAYLOAD=y \
FW_PAYLOAD_OFFSET=0x40000 \
FW_PAYLOAD_PATH=u-boot-dtb.bin

fails:

riscv64-linux-gnu/bin/ld:
opensbi/build/platform/kendryte/k210/firmware/fw_payload.o:
in function `.L0 ':
opensbi/firmware/fw_base.S:77:
undefined reference to `__rel_dyn_start' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:78:
undefined reference to `__rel_dyn_end' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:89:
undefined reference to `__dyn_sym_start'
collect2: error: ld returned 1 exit status

With FW_PIC=n building becomes possible.

Fixes bf3ef53bb7f5 ("firmware: Enable FW_PIC by default")

---
We need a description of what FW_PIC does in and a description of how to build for the K210 platform. in doc/.

---
 platform/kendryte/k210/config.mk | 3 +++
 1 file changed, 3 insertions(+)
platform/kendryte/k210/config.mk +3 -0
index 8a9b814..c664ba1 100644
@@ -17,3 +17,6 @@ platform-ldflags-y =
 FW_TEXT_START=0x80000000
 FW_PAYLOAD=y
 FW_PAYLOAD_ALIGN=0x1000
+
+# Others
+FW_PIC=n

--
2.30.2

#1 lore raw

RFC 1/1 platform/kendryte: disable FW_PIC

Quoted 12 lines · Heinrich Schuchardt

Since commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default") building with

make \
PLATFORM=kendryte/k210 \
FW_PAYLOAD=y \
FW_PAYLOAD_OFFSET=0x40000 \
FW_PAYLOAD_PATH=u-boot-dtb.bin

fails:

Quoted 13 lines

riscv64-linux-gnu/bin/ld:
opensbi/build/platform/kendryte/k210/firmware/fw_payload.o:
in function `.L0 ':
opensbi/firmware/fw_base.S:77:
undefined reference to `__rel_dyn_start' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:78:
undefined reference to `__rel_dyn_end' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:89:
undefined reference to `__dyn_sym_start'
collect2: error: ld returned 1 exit status

It looks like your toolchain is broken. I can build with your command without any error. I am using buildroot 2020.08-1 toolchain.

Quoted 18 lines

With FW_PIC=n building becomes possible.

Fixes bf3ef53bb7f5 ("firmware: Enable FW_PIC by default")

---
We need a description of what FW_PIC does in and a description of how to build for the K210 platform. in doc/.

---
 platform/kendryte/k210/config.mk | 3 +++
 1 file changed, 3 insertions(+)
platform/kendryte/k210/config.mk +0 -0
index 8a9b814..c664ba1 100644

platform/kendryte/k210/config.mk platform-ldflags-y = · line 22

Quoted 6 lines
platform/kendryte/k210/config.mk +3 -0
@@ -17,3 +17,6 @@ platform-ldflags-y =
 FW_TEXT_START=0x80000000
 FW_PAYLOAD=y
 FW_PAYLOAD_ALIGN=0x1000
+
+# Others
+FW_PIC=n

Regards,
Bin

#2 lore raw

RFC 1/1 platform/kendryte: disable FW_PIC

Quoted 28 lines · Bin Meng
Quoted 12 lines · Heinrich Schuchardt

Since commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default") building with

make \
PLATFORM=kendryte/k210 \
FW_PAYLOAD=y \
FW_PAYLOAD_OFFSET=0x40000 \
FW_PAYLOAD_PATH=u-boot-dtb.bin

fails:

Quoted 13 lines

riscv64-linux-gnu/bin/ld:
opensbi/build/platform/kendryte/k210/firmware/fw_payload.o:
in function `.L0 ':
opensbi/firmware/fw_base.S:77:
undefined reference to `__rel_dyn_start' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:78:
undefined reference to `__rel_dyn_end' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:89:
undefined reference to `__dyn_sym_start'
collect2: error: ld returned 1 exit status

Quoted 12 lines

It looks like your toolchain is broken. I can build with your command without any error. I am using buildroot 2020.08-1 toolchain.

Quoted 9 lines

With FW_PIC=n building becomes possible.

Fixes bf3ef53bb7f5 ("firmware: Enable FW_PIC by default")

---
We need a description of what FW_PIC does in and a description of how to build for the K210 platform. in doc/.
---

And FW_PIC is already documented in docs/firmware/fw.md

Regards,
Bin

#3 lore raw

RFC 1/1 platform/kendryte: disable FW_PIC

In reply to Bin Meng
Quoted 27 lines · Bin Meng
Quoted 12 lines · Heinrich Schuchardt

Since commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default") building with

make \
PLATFORM=kendryte/k210 \
FW_PAYLOAD=y \
FW_PAYLOAD_OFFSET=0x40000 \
FW_PAYLOAD_PATH=u-boot-dtb.bin

fails:

Quoted 13 lines

riscv64-linux-gnu/bin/ld:
opensbi/build/platform/kendryte/k210/firmware/fw_payload.o:
in function `.L0 ':
opensbi/firmware/fw_base.S:77:
undefined reference to `__rel_dyn_start' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:78:
undefined reference to `__rel_dyn_end' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:89:
undefined reference to `__dyn_sym_start'
collect2: error: ld returned 1 exit status

Quoted 2 lines

It looks like your toolchain is broken. I can build with your command without any error. I am using buildroot 2020.08-1 toolchain.

With the "riscv64-linux-gnu" [1] toolchain, I get the above error.

With the "riscv64-elf" toolchain [2], everything compiles fine.

--Sean

[1] https://archlinux.org/packages/community/x86_64/riscv64-linux-gnu-gcc/
[2] https://archlinux.org/packages/community/x86_64/riscv64-elf-gcc/

Quoted 29 lines
Quoted 19 lines

With FW_PIC=n building becomes possible.

Fixes bf3ef53bb7f5 ("firmware: Enable FW_PIC by default")

---
We need a description of what FW_PIC does in and a description of how to build for the K210 platform. in doc/.

---
  platform/kendryte/k210/config.mk | 3 +++
  1 file changed, 3 insertions(+)
platform/kendryte/k210/config.mk +0 -0
index 8a9b814..c664ba1 100644

platform/kendryte/k210/config.mk platform-ldflags-y = · line 22

Quoted 6 lines
platform/kendryte/k210/config.mk +3 -0
@@ -17,3 +17,6 @@ platform-ldflags-y =
  FW_TEXT_START=0x80000000
  FW_PAYLOAD=y
  FW_PAYLOAD_ALIGN=0x1000
+
+# Others
+FW_PIC=n

Regards,
Bin

#4 lore raw

RFC 1/1 platform/kendryte: disable FW_PIC

Quoted 29 lines · Sean Anderson
Quoted 27 lines · Bin Meng
Quoted 25 lines · Heinrich Schuchardt

Since commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default") building with

make \
PLATFORM=kendryte/k210 \
FW_PAYLOAD=y \
FW_PAYLOAD_OFFSET=0x40000 \
FW_PAYLOAD_PATH=u-boot-dtb.bin

fails:

riscv64-linux-gnu/bin/ld:
opensbi/build/platform/kendryte/k210/firmware/fw_payload.o:
in function `.L0 ':
opensbi/firmware/fw_base.S:77:
undefined reference to `__rel_dyn_start' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:78:
undefined reference to `__rel_dyn_end' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:89:
undefined reference to `__dyn_sym_start'
collect2: error: ld returned 1 exit status

Quoted 6 lines
Quoted 2 lines

It looks like your toolchain is broken. I can build with your command without any error. I am using buildroot 2020.08-1 toolchain.

With the "riscv64-linux-gnu" [1] toolchain, I get the above error.

With the "riscv64-elf" toolchain [2], everything compiles fine.

I am not seeing this compile error. I am using riscv64-unknown-linux-gnu toolchain.

Using built-in specs.
COLLECT_GCC=riscv64-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/home/anup/Work/tools/riscv/mlocal/libexec/gcc/riscv64-unknown-linux-gnu/9.2.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with:
/home/anup/Work/riscv-test/riscv-gnu-toolchain/riscv-gcc/configure --target=riscv64-unknown-linux-gnu
--prefix=/home/anup/Work/tools/riscv/mlocal --with-sysroot=/home/anup/Work/tools/riscv/mlocal/sysroot
--with-system-zlib --enable-shared --enable-tls
--enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp
--disable-libquadmath --disable-nls --disable-bootstrap
--src=.././riscv-gcc --enable-multilib --with-abi=lp64d
--with-arch=rv64imafdc --with-tune=rocket 'CFLAGS_FOR_TARGET=-O2
-mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2 -mcmodel=medlow'
Thread model: posix
gcc version 9.2.0 (GCC)

What am I missing ?

Regards,
Anup

Quoted 41 lines

--Sean

[1] https://archlinux.org/packages/community/x86_64/riscv64-linux-gnu-gcc/
[2] https://archlinux.org/packages/community/x86_64/riscv64-elf-gcc/

Quoted 13 lines
Quoted 13 lines

With FW_PIC=n building becomes possible.

Fixes bf3ef53bb7f5 ("firmware: Enable FW_PIC by default")

---
We need a description of what FW_PIC does in and a description of how to build for the K210 platform. in doc/.

---
  platform/kendryte/k210/config.mk | 3 +++
  1 file changed, 3 insertions(+)
Quoted 16 lines

platform/kendryte/k210/config.mk platform-ldflags-y = · line 22

Quoted 12 lines
platform/kendryte/k210/config.mk +3 -0
index 8a9b814..c664ba1 100644
@@ -17,3 +17,6 @@ platform-ldflags-y =
  FW_TEXT_START=0x80000000
  FW_PAYLOAD=y
  FW_PAYLOAD_ALIGN=0x1000
+
+# Others
+FW_PIC=n

Regards,
Bin

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

#5 lore raw

RFC 1/1 platform/kendryte: disable FW_PIC

Quoted 58 lines · Anup Patel
Quoted 29 lines · Sean Anderson
Quoted 27 lines · Bin Meng
Quoted 25 lines · Heinrich Schuchardt

Since commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default") building with

make \
PLATFORM=kendryte/k210 \
FW_PAYLOAD=y \
FW_PAYLOAD_OFFSET=0x40000 \
FW_PAYLOAD_PATH=u-boot-dtb.bin

fails:

riscv64-linux-gnu/bin/ld:
opensbi/build/platform/kendryte/k210/firmware/fw_payload.o:
in function `.L0 ':
opensbi/firmware/fw_base.S:77:
undefined reference to `__rel_dyn_start' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:78:
undefined reference to `__rel_dyn_end' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:89:
undefined reference to `__dyn_sym_start'
collect2: error: ld returned 1 exit status

Quoted 6 lines
Quoted 2 lines

It looks like your toolchain is broken. I can build with your command without any error. I am using buildroot 2020.08-1 toolchain.

With the "riscv64-linux-gnu" [1] toolchain, I get the above error.

With the "riscv64-elf" toolchain [2], everything compiles fine.

I am not seeing this compile error. I am using riscv64-unknown-linux-gnu toolchain.

Using built-in specs.
COLLECT_GCC=riscv64-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/home/anup/Work/tools/riscv/mlocal/libexec/gcc/riscv64-unknown-linux-gnu/9.2.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with:
/home/anup/Work/riscv-test/riscv-gnu-toolchain/riscv-gcc/configure --target=riscv64-unknown-linux-gnu
--prefix=/home/anup/Work/tools/riscv/mlocal --with-sysroot=/home/anup/Work/tools/riscv/mlocal/sysroot
--with-system-zlib --enable-shared --enable-tls
--enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp
--disable-libquadmath --disable-nls --disable-bootstrap
--src=.././riscv-gcc --enable-multilib --with-abi=lp64d
--with-arch=rv64imafdc --with-tune=rocket 'CFLAGS_FOR_TARGET=-O2
-mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2 -mcmodel=medlow'
Thread model: posix
gcc version 9.2.0 (GCC)

Quoted 1 line

What am I missing ?

Mine reports

Using built-in specs.
COLLECT_GCC=riscv64-elf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-elf/11.1.0/lto-wrapper
Target: riscv64-elf
Configured with: /build/riscv64-elf-gcc/src/gcc-11.1.0/configure --target=riscv64-elf --prefix=/usr --with-sysroot=/usr/riscv64-elf --with-native-system-header-dir=/include --libexecdir=/usr/lib --enable-languages=c,c++ --enable-threads=single --enable-plugins --enable-multilib --enable-libgcc --disable-libgomp --disable-libquadmath --disable-libffi --disable-libssp --disable-libmudflap --disable-decimal-float --disable-libstdcxx-pch --disable-nls --disable-shared --disable-tls --with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib --with-headers=/usr/riscv64-elf/include --with-python-dir=share/gcc-riscv64-elf --with-gmp --with-mpfr --with-mpc --with-isl --with-libelf --enable-gnu-indirect-function --with-pkgversion='Arch Linux Repositories' --with-bugurl=https://bugs.archlinux.org/ Thread model: single
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Arch Linux Repositories)

with the difference being

gcc-linux renamed from gcc-anup +34 -20
@@ -1,27 +1,41 @@
  Using built-in specs.
-COLLECT_GCC=riscv64-unknown-linux-gnu-gcc
-COLLECT_LTO_WRAPPER=/home/anup/Work/tools/riscv/mlocal/libexec/gcc/riscv64-unknown-linux-gnu/9.2.0/lto-wrapper
-Target: riscv64-unknown-linux-gnu
+COLLECT_GCC=riscv64-linux-gnu-gcc
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/11.1.0/lto-wrapper
+Target: riscv64-linux-gnu
  Configured with:
-/home/anup/Work/riscv-test/riscv-gnu-toolchain/riscv-gcc/configure
-'CXXFLAGS_FOR_TARGET=-O2'
---disable-bootstrap
---disable-libmudflap
---disable-libquadmath
+/build/riscv64-linux-gnu-gcc/src/gcc-11.1.0/configure
+--build=x86_64-pc-linux-gnu
  --disable-libssp
+--disable-libstdcxx-pch
+--disable-libunwind-exceptions
+--disable-multilib
  --disable-nls
---enable-languages=c,c++,fortran
---enable-multilib
+--disable-werror
+--enable-__cxa_atexit
+--enable-checking=release
+--enable-clocale=gnu
+--enable-default-pie
+--enable-gnu-indirect-function
+--enable-gnu-unique-object
+--enable-install-libiberty
+--enable-languages=c,c++
+--enable-linker-build-id
+--enable-lto
+--enable-plugin
  --enable-shared
---enable-tls
---prefix=/home/anup/Work/tools/riscv/mlocal
---src=.././riscv-gcc
---target=riscv64-unknown-linux-gnu
---with-abi=lp64d
---with-arch=rv64imafdc
---with-sysroot=/home/anup/Work/tools/riscv/mlocal/sysroot
+--enable-threads=posix
+--host=x86_64-pc-linux-gnu
+--libdir=/usr/lib
+--libexecdir=/usr/lib
+--prefix=/usr
+--program-prefix=riscv64-linux-gnu-
+--target=riscv64-linux-gnu
+--with-build-sysroot=/usr/riscv64-linux-gnu
+--with-isl
+--with-linker-hash-style=gnu
+--with-local-prefix=/usr/riscv64-linux-gnu
+--with-sysroot=/usr/riscv64-linux-gnu
  --with-system-zlib
---with-tune=rocket
--mcmodel=medlow
  Thread model: posix
-gcc version 9.2.0 (GCC)
+Supported LTO compression algorithms: zlib zstd
+gcc version 11.1.0 (GCC)

Nothing in the configure flags pops out to me, but perhaps the issue is between 9 and 11? For comparison, the difference between my -linux-gnu and -elf is:

gcc-elf renamed from gcc-linux +31 -30

72 lines not on this page · raw message

--Sean

#6 lore raw

RFC 1/1 platform/kendryte: disable FW_PIC

Quoted 64 lines · Sean Anderson
Quoted 58 lines · Anup Patel
Quoted 29 lines · Sean Anderson
Quoted 27 lines · Bin Meng
Quoted 25 lines · Heinrich Schuchardt

Since commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default") building with

make \
PLATFORM=kendryte/k210 \
FW_PAYLOAD=y \
FW_PAYLOAD_OFFSET=0x40000 \
FW_PAYLOAD_PATH=u-boot-dtb.bin

fails:

riscv64-linux-gnu/bin/ld:
opensbi/build/platform/kendryte/k210/firmware/fw_payload.o:
in function `.L0 ':
opensbi/firmware/fw_base.S:77:
undefined reference to `__rel_dyn_start' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:78:
undefined reference to `__rel_dyn_end' riscv64-linux-gnu/bin/ld:
opensbi/firmware/fw_base.S:89:
undefined reference to `__dyn_sym_start'
collect2: error: ld returned 1 exit status

Quoted 6 lines
Quoted 2 lines

It looks like your toolchain is broken. I can build with your command without any error. I am using buildroot 2020.08-1 toolchain.

With the "riscv64-linux-gnu" [1] toolchain, I get the above error.

With the "riscv64-elf" toolchain [2], everything compiles fine.

I am not seeing this compile error. I am using riscv64-unknown-linux-gnu toolchain.

Using built-in specs.
COLLECT_GCC=riscv64-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/home/anup/Work/tools/riscv/mlocal/libexec/gcc/riscv64-unknown-linux-gnu/9.2.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with:
/home/anup/Work/riscv-test/riscv-gnu-toolchain/riscv-gcc/configure --target=riscv64-unknown-linux-gnu
--prefix=/home/anup/Work/tools/riscv/mlocal --with-sysroot=/home/anup/Work/tools/riscv/mlocal/sysroot
--with-system-zlib --enable-shared --enable-tls
--enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp
--disable-libquadmath --disable-nls --disable-bootstrap
--src=.././riscv-gcc --enable-multilib --with-abi=lp64d
--with-arch=rv64imafdc --with-tune=rocket 'CFLAGS_FOR_TARGET=-O2
-mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2?? -mcmodel=medlow'
Thread model: posix
gcc version 9.2.0 (GCC)

Quoted 1 line

What am I missing ?

Mine reports

Quoted 8 lines

Using built-in specs.
COLLECT_GCC=riscv64-elf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-elf/11.1.0/lto-wrapper
Target: riscv64-elf
Configured with: /build/riscv64-elf-gcc/src/gcc-11.1.0/configure --target=riscv64-elf --prefix=/usr --with-sysroot=/usr/riscv64-elf --with-native-system-header-dir=/include --libexecdir=/usr/lib --enable-languages=c,c++ --enable-threads=single --enable-plugins --enable-multilib --enable-libgcc --disable-libgomp --disable-libquadmath --disable-libffi --disable-libssp --disable-libmudflap --disable-decimal-float --disable-libstdcxx-pch --disable-nls --disable-shared --disable-tls --with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib --with-headers=/usr/riscv64-elf/include --with-python-dir=share/gcc-riscv64-elf --with-gmp --with-mpfr --with-mpc --with-isl --with-libelf --enable-gnu-indirect-function --with-pkgversion='Arch Linux Repositories' --with-bugurl=https://bugs.archlinux.org/ Thread model: single
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Arch Linux Repositories)

whoops, I copied the wrong one here, should be

Using built-in specs.
COLLECT_GCC=riscv64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/11.1.0/lto-wrapper
Target: riscv64-linux-gnu
Configured with: /build/riscv64-linux-gnu-gcc/src/gcc-11.1.0/configure --prefix=/usr --program-prefix=riscv64-linux-gnu- --with-local-prefix=/usr/riscv64-linux-gnu --with-sysroot=/usr/riscv64-linux-gnu --with-build-sysroot=/usr/riscv64-linux-gnu --libdir=/usr/lib --libexecdir=/usr/lib --target=riscv64-linux-gnu --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --with-system-zlib --with-isl --with-linker-hash-style=gnu --disable-nls --disable-libunwind-exceptions --disable-libstdcxx-pch --disable-libssp --disable-multilib --disable-werror --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --enable-gnu-indirect-function --enable-default-pie --enable-checking=release Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (GCC)

Quoted 149 lines

with the difference being

gcc-linux??? 2021-09-04 11:47:32.411810152 -0400 renamed from gcc-anup??? 2021-09-04 11:47:35.801813191 -0400 +34 -20
@@ -1,27 +1,41 @@
 ?Using built-in specs.
-COLLECT_GCC=riscv64-unknown-linux-gnu-gcc
-COLLECT_LTO_WRAPPER=/home/anup/Work/tools/riscv/mlocal/libexec/gcc/riscv64-unknown-linux-gnu/9.2.0/lto-wrapper
-Target: riscv64-unknown-linux-gnu
+COLLECT_GCC=riscv64-linux-gnu-gcc
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/11.1.0/lto-wrapper
+Target: riscv64-linux-gnu
 ?Configured with:
-/home/anup/Work/riscv-test/riscv-gnu-toolchain/riscv-gcc/configure
-'CXXFLAGS_FOR_TARGET=-O2'
---disable-bootstrap
---disable-libmudflap
---disable-libquadmath
+/build/riscv64-linux-gnu-gcc/src/gcc-11.1.0/configure
+--build=x86_64-pc-linux-gnu
 ?--disable-libssp
+--disable-libstdcxx-pch
+--disable-libunwind-exceptions
+--disable-multilib
 ?--disable-nls
---enable-languages=c,c++,fortran
---enable-multilib
+--disable-werror
+--enable-__cxa_atexit
+--enable-checking=release
+--enable-clocale=gnu
+--enable-default-pie
+--enable-gnu-indirect-function
+--enable-gnu-unique-object
+--enable-install-libiberty
+--enable-languages=c,c++
+--enable-linker-build-id
+--enable-lto
+--enable-plugin
 ?--enable-shared
---enable-tls
---prefix=/home/anup/Work/tools/riscv/mlocal
---src=.././riscv-gcc
---target=riscv64-unknown-linux-gnu
---with-abi=lp64d
---with-arch=rv64imafdc
---with-sysroot=/home/anup/Work/tools/riscv/mlocal/sysroot
+--enable-threads=posix
+--host=x86_64-pc-linux-gnu
+--libdir=/usr/lib
+--libexecdir=/usr/lib
+--prefix=/usr
+--program-prefix=riscv64-linux-gnu-
+--target=riscv64-linux-gnu
+--with-build-sysroot=/usr/riscv64-linux-gnu
+--with-isl
+--with-linker-hash-style=gnu
+--with-local-prefix=/usr/riscv64-linux-gnu
+--with-sysroot=/usr/riscv64-linux-gnu
 ?--with-system-zlib
---with-tune=rocket
--mcmodel=medlow
 ?Thread model: posix
-gcc version 9.2.0 (GCC)
+Supported LTO compression algorithms: zlib zstd
+gcc version 11.1.0 (GCC)

Nothing in the configure flags pops out to me, but perhaps the issue is between 9 and 11? For comparison, the difference between my -linux-gnu and -elf is:

gcc-elf??? 2021-09-04 11:48:26.141859419 -0400 renamed from gcc-linux??? 2021-09-04 11:47:32.411810152 -0400 +31 -31
@@ -1,41 +1,42 @@
 ?Using built-in specs.
-COLLECT_GCC=riscv64-linux-gnu-gcc
-COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/11.1.0/lto-wrapper
-Target: riscv64-linux-gnu
-Configured with:
-/build/riscv64-linux-gnu-gcc/src/gcc-11.1.0/configure
---build=x86_64-pc-linux-gnu
+COLLECT_GCC=riscv64-elf-gcc
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-elf/11.1.0/lto-wrapper
+Target: riscv64-elf
+Configured with: /build/riscv64-elf-gcc/src/gcc-11.1.0/configure
+--disable-decimal-float
+--disable-libffi
+--disable-libgomp
+--disable-libmudflap
+--disable-libquadmath
 ?--disable-libssp
 ?--disable-libstdcxx-pch
---disable-libunwind-exceptions
---disable-multilib
 ?--disable-nls
---disable-werror
---enable-__cxa_atexit
---enable-checking=release
---enable-clocale=gnu
---enable-default-pie
+--disable-shared
+--disable-tls
 ?--enable-gnu-indirect-function
---enable-gnu-unique-object
---enable-install-libiberty
 ?--enable-languages=c,c++
---enable-linker-build-id
---enable-lto
---enable-plugin
---enable-shared
---enable-threads=posix
---host=x86_64-pc-linux-gnu
---libdir=/usr/lib
+--enable-libgcc
+--enable-multilib
+--enable-plugins
+--enable-threads=single
 ?--libexecdir=/usr/lib
 ?--prefix=/usr
---program-prefix=riscv64-linux-gnu-
---target=riscv64-linux-gnu
---with-build-sysroot=/usr/riscv64-linux-gnu
+--target=riscv64-elf
+--with-bugurl=https://bugs.archlinux.org/
+--with-gmp
+--with-gnu-as
+--with-gnu-ld
+--with-headers=/usr/riscv64-elf/include
 ?--with-isl
---with-linker-hash-style=gnu
---with-local-prefix=/usr/riscv64-linux-gnu
---with-sysroot=/usr/riscv64-linux-gnu
+--with-libelf
+--with-mpc
+--with-mpfr
+--with-native-system-header-dir=/include
+--with-newlib
+--with-pkgversion='Arch Linux Repositories'
+--with-python-dir=share/gcc-riscv64-elf
+--with-sysroot=/usr/riscv64-elf
 ?--with-system-zlib
-Thread model: posix
+Thread model: single
 ?Supported LTO compression algorithms: zlib zstd
-gcc version 11.1.0 (GCC)
+gcc version 11.1.0 (Arch Linux Repositories)
 
--Sean