Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc-sh-elf-newlib build fails for GCC 10.1 #33

Open
michalsieron opened this issue Sep 24, 2021 · 2 comments
Open

gcc-sh-elf-newlib build fails for GCC 10.1 #33

michalsieron opened this issue Sep 24, 2021 · 2 comments

Comments

@michalsieron
Copy link
Contributor

CI in #31 revealed, that gcc-newlib-sh-linux step is failing (run#3651807217).

There seems to a problem with duplicate _errno symbols (see line 65617 of logs).

Here it is cleaned up a little bit:

$PREFIX/sh-elf/bin/ld:
  $PREFIX/sh-elf/lib/libc.a(lib_a-syscalls.o):(.bss+0x0): multiple definition of `_errno';
  $PREFIX/sh-elf/lib/libc.a(lib_a-reent.o):(.bss+0x0): first defined here

Below is a comparison of *_errno symbols in newlib libc compiled with GCC 9.2 and GCC 10.1:

$ # GCC 9.2
$ sh-elf-nm -g sh-elf/lib/libc.a | grep _errno | sort | uniq -c
     20          U ___errno
     17          U _errno
      1 00000000 T ___errno
      2 00000004 C _errno
$ # GCC 10.1
$ sh-elf-nm -g sh-elf/lib/libc.a | grep _errno | sort | uniq -c
     20          U ___errno
     17          U _errno
      2 00000000 B _errno
      1 00000000 T ___errno

Looks like _errnos are in BSS and not in COMMON section.

I'm pretty confident, that this is a reason: https://wiki.gentoo.org/wiki/Project:Toolchain/Gcc_10_porting_notes/fno_common

Although neither adding CFLAGS=-fcommon in make call or before configure seems to help.

For this reason we skip the gcc-sh-elf-newlib-linux for now, but it needs to be repaired.

michalsieron added a commit that referenced this issue Sep 24, 2021
gcc-10 and above flipped a default from -fcommon to -fno-common.
SH version of newlib has duplicate symbols after compiling with GCC
10.1.
@mithro
Copy link
Member

mithro commented Sep 24, 2021

@cr1901 -- Any ideas?

@cr1901
Copy link
Contributor

cr1901 commented Sep 24, 2021

@mithro No, I've never seen this error before, and I would expect adding -fcommon to CFLAGS would fix it. This might require a dive into the autotools machinery to figure out why -fcommon isn't being honored.

Did you do a make distclean before adding the new flags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants