Skip to contentSkip to conversation

ARC: Import entire libgcc from GCC 8.1.0

PATCH New Alexey Brodkin 2 participants 2 messages Jun 7, 2018 – Jun 8, 2018 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARC: Import entire libgcc from GCC 8.1.0

Some background on private libgcc on ARC first.

The whole point of having private libgcc in U-Boot is to be toolchain agnostic. I.e. have an ability to use any more or less up-to-date ARC GNU tools for building U-Boot for any platform with ARC core.

As of today we have at least 6 (sic!) flavors of GNU toolchains for ARC.
1. Little-endian multilib Elf32
2. Big-endian multilib Elf32
3. Little-endian uClibc for ARC700 (ARCompact or ARCv1 ISA)
4. Big-endian uClibc for ARC700
5. Little-endian uClibc for ARC HS (ARCv2 ISA)
6. Big-endian uClibc for ARC HS

In foreseeable future we'll have multilib Linux toolchain so we'll cut number of tools down to 4. Anyways...

In general we don't need Linux toolchain for building U-Boot and since Elf32 GNU tools have libs for most of "standard" ARC core templates [1] it might be a good toolchain for U-Boot. But:
1. Still big-/little-endian platforms require different tools
2. Developers need to have Linux toolchain for user-space stuff because of C-library
3. People tend to build more Linux tools, like Linux kernel crootools

So it looks like multilib Linux toolchain might be a bit more convenient option, at least it addresses (2) and (3) from above, i.e. we'll only need to deal with big-/little-endian story and that should be fine as not that many developers in the world play simultaneously with platforms of both types.

But no! Linux multilib toolchain will only be built for very limited list of mcpu's [2]. Basically only "arc700" and "archs" (with few flavors for HS38 templates). That's because only those cores are capable of running Linux and uClibc/glibc couldn't be built for others. I.e. all the simpler cores where U-Boot could be perfectly used [and in fact is used more and more] won't have libgcc pre-built as the part of the toolchain.

And really ultimate solution is to build libgcc as a part of U-Boot and have no external dependencies. That's something that we used to do for quite some time [3] with limited amount of functions really required by existing platforms. But with addition of more platforms like those with missing multiplier (MPY and friends) we need to have more libgcc functions and to make things simple and at the same time very optimal we're importing entire libgcc for ARC from latest stable GCC (8.1.0 as of today).

[1] https://github.com/gcc-mirror/gcc/blob/master/gcc/config/arc/t-multilib#L24
[2] https://github.com/gcc-mirror/gcc/blob/master/gcc/config/arc/t-multilib-linux#L19
[3] http://git.denx.de/?p=u-boot.git;a=commit;h=a67ef280f46803e319639f5380ff8da6c6b7fbe7

---

Since that's an import from GCC I intentionally didn't do any changes to imported files. And that means checkpatch.pl is pretty unhappy. In particular because:
1. SPDX license header is missing
2. Some identation made with spaces
3. Spaces are missing in code or there're more than needed
4. A couple of "#if 0"
etc etc.

And that poses a question: what is mandatory to be fixed and what not?

1. I guess SPDX license header MUST be inserted, right?
2. All the rest I'd really like to keep as it is now to simplify subsequent updates of newer libgcc versions.

Any thoughts?

 arch/arc/lib/Makefile                       |   14 +-
 arch/arc/lib/_millicodethunk.S              |  225 ---
 arch/arc/lib/asm.h                          |   29 +
 arch/arc/lib/dp-hack.h                      |  103 ++
 arch/arc/lib/fp-hack.h                      |   87 ++
 arch/arc/lib/ieee-754/adddf3.S              |  524 +++++++
 arch/arc/lib/ieee-754/addsf3.S              |  344 +++++
 arch/arc/lib/ieee-754/arc-ieee-754.h        |   63 +
 arch/arc/lib/ieee-754/arc600-dsp/divdf3.S   |  421 ++++++
 arch/arc/lib/ieee-754/arc600-dsp/divsf3.S   |  274 ++++
 arch/arc/lib/ieee-754/arc600-dsp/muldf3.S   |  231 +++
 arch/arc/lib/ieee-754/arc600-dsp/mulsf3.S   |  176 +++
 arch/arc/lib/ieee-754/arc600-mul64/divdf3.S |  410 ++++++
 arch/arc/lib/ieee-754/arc600-mul64/divsf3.S |  274 ++++
 arch/arc/lib/ieee-754/arc600-mul64/muldf3.S |  234 +++
 arch/arc/lib/ieee-754/arc600-mul64/mulsf3.S |  180 +++
 arch/arc/lib/ieee-754/arc600/divsf3.S       |  227 +++
 arch/arc/lib/ieee-754/arc600/mulsf3.S       |  179 +++
 arch/arc/lib/ieee-754/divdf3.S              |  435 ++++++
 arch/arc/lib/ieee-754/divsf3-stdmul.S       |  281 ++++
 arch/arc/lib/ieee-754/divsf3.S              |  221 +++
 arch/arc/lib/ieee-754/divtab-arc-df.c       |  161 +++
 arch/arc/lib/ieee-754/divtab-arc-sf.c       |  127 ++
 arch/arc/lib/ieee-754/eqdf2.S               |   81 ++
 arch/arc/lib/ieee-754/eqsf2.S               |   69 +
 arch/arc/lib/ieee-754/extendsfdf2.S         |  122 ++
 arch/arc/lib/ieee-754/fixdfsi.S             |   85 ++
 arch/arc/lib/ieee-754/fixsfsi.S             |   71 +
 arch/arc/lib/ieee-754/fixunsdfsi.S          |   80 ++
 arch/arc/lib/ieee-754/floatsidf.S           |   77 +
 arch/arc/lib/ieee-754/floatsisf.S           |   99 ++
 arch/arc/lib/ieee-754/floatunsidf.S         |   75 +
 arch/arc/lib/ieee-754/gedf2.S               |   86 ++
 arch/arc/lib/ieee-754/gesf2.S               |   75 +
 arch/arc/lib/ieee-754/gtdf2.S               |   86 ++
 arch/arc/lib/ieee-754/gtsf2.S               |   75 +
 arch/arc/lib/ieee-754/muldf3.S              |  235 +++
 arch/arc/lib/ieee-754/mulsf3.S              |  180 +++
 arch/arc/lib/ieee-754/orddf2.S              |   63 +
 arch/arc/lib/ieee-754/ordsf2.S              |   63 +
 arch/arc/lib/ieee-754/truncdfsf2.S          |  134 ++
 arch/arc/lib/ieee-754/uneqdf2.S             |   73 +
 arch/arc/lib/ieee-754/uneqsf2.S             |   69 +
 arch/arc/lib/lib1funcs.S                    | 1430 +++++++++++++++++++
 arch/arc/lib/libgcc2.c                      |   84 --
 45 files changed, 8321 insertions(+), 311 deletions(-)
 delete mode 100644 arch/arc/lib/_millicodethunk.S
 create mode 100644 arch/arc/lib/asm.h
 create mode 100644 arch/arc/lib/dp-hack.h
 create mode 100644 arch/arc/lib/fp-hack.h
 create mode 100644 arch/arc/lib/ieee-754/adddf3.S
 create mode 100644 arch/arc/lib/ieee-754/addsf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc-ieee-754.h
 create mode 100644 arch/arc/lib/ieee-754/arc600-dsp/divdf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600-dsp/divsf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600-dsp/muldf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600-dsp/mulsf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600-mul64/divdf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600-mul64/divsf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600-mul64/muldf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600-mul64/mulsf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600/divsf3.S
 create mode 100644 arch/arc/lib/ieee-754/arc600/mulsf3.S
 create mode 100644 arch/arc/lib/ieee-754/divdf3.S
 create mode 100644 arch/arc/lib/ieee-754/divsf3-stdmul.S
 create mode 100644 arch/arc/lib/ieee-754/divsf3.S
 create mode 100644 arch/arc/lib/ieee-754/divtab-arc-df.c
 create mode 100644 arch/arc/lib/ieee-754/divtab-arc-sf.c
 create mode 100644 arch/arc/lib/ieee-754/eqdf2.S
 create mode 100644 arch/arc/lib/ieee-754/eqsf2.S
 create mode 100644 arch/arc/lib/ieee-754/extendsfdf2.S
 create mode 100644 arch/arc/lib/ieee-754/fixdfsi.S
 create mode 100644 arch/arc/lib/ieee-754/fixsfsi.S
 create mode 100644 arch/arc/lib/ieee-754/fixunsdfsi.S
 create mode 100644 arch/arc/lib/ieee-754/floatsidf.S
 create mode 100644 arch/arc/lib/ieee-754/floatsisf.S
 create mode 100644 arch/arc/lib/ieee-754/floatunsidf.S
 create mode 100644 arch/arc/lib/ieee-754/gedf2.S
 create mode 100644 arch/arc/lib/ieee-754/gesf2.S
 create mode 100644 arch/arc/lib/ieee-754/gtdf2.S
 create mode 100644 arch/arc/lib/ieee-754/gtsf2.S
 create mode 100644 arch/arc/lib/ieee-754/muldf3.S
 create mode 100644 arch/arc/lib/ieee-754/mulsf3.S
 create mode 100644 arch/arc/lib/ieee-754/orddf2.S
 create mode 100644 arch/arc/lib/ieee-754/ordsf2.S
 create mode 100644 arch/arc/lib/ieee-754/truncdfsf2.S
 create mode 100644 arch/arc/lib/ieee-754/uneqdf2.S
 create mode 100644 arch/arc/lib/ieee-754/uneqsf2.S
 create mode 100644 arch/arc/lib/lib1funcs.S
arch/arc/lib/Makefile +12 -2
index 0eb44bcf33d0..7fd194d528f5 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
-# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
+# Copyright (C) 2013-2014, 2018 Synopsys, Inc. All rights reserved.
 
 extra-y	= start.o
 head-y := start.o
@@ -14,4 +14,14 @@ obj-y += init_helpers.o
 
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 
-lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _millicodethunk.o libgcc2.o
+LIB1ASMFUNCS = _mulsi3 _umulsidi3  _umulsi3_highpart \
+  _udivsi3 _divsi3 _umodsi3 _modsi3 \
+  _divmod_tools _clzsi2 \
+  _millicodethunk_st _millicodethunk_ld _millicodethunk_ret \
+  _adddf3 _muldf3 _addsf3 _mulsf3 _divsf3 _divdf3 _truncdfsf2 _extendsfdf2 \
+  _eqdf2 _eqsf2 _gedf2 _gesf2 _gtdf2 _gtsf2 _uneqdf2 _uneqsf2 _ordsf2 _orddf2 \
+  _fixdfsi _fixsfsi _floatsidf _floatsisf _fixunsdfsi _floatunsidf
+
+AFLAGS_lib1funcs.o += $(addprefix -DL, $(LIB1ASMFUNCS))
+
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lib1funcs.o libgcc2.o
arch/arc/lib/_millicodethunk.S deleted +0 -225

225 lines not on this page · raw message

arch/arc/lib/asm.h new file +29 -0
new file mode 100644
index 000000000000..4f22786959e1
@@ -0,0 +1,29 @@
+/* Assembler macros for the Synopsys DesignWare ARC CPU.
+
+   Copyright (C) 1994-2018 Free Software Foundation, Inc.
+   Contributor: Joern Rennecke <[email protected]>
+		on behalf of Synopsys Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#define FUNC(X)         .type X, at function
+#define ENDFUNC(X)      .size X, .-X
arch/arc/lib/dp-hack.h new file +103 -0

103 lines not on this page · raw message

arch/arc/lib/fp-hack.h new file +87 -0

87 lines not on this page · raw message

arch/arc/lib/ieee-754/adddf3.S new file +524 -0

524 lines not on this page · raw message

arch/arc/lib/ieee-754/addsf3.S new file +344 -0

344 lines not on this page · raw message

arch/arc/lib/ieee-754/arc-ieee-754.h new file +63 -0

63 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600-dsp/divdf3.S new file +421 -0

421 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600-dsp/divsf3.S new file +274 -0

274 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600-dsp/muldf3.S new file +231 -0

231 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600-dsp/mulsf3.S new file +176 -0

176 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600-mul64/divdf3.S new file +410 -0

410 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600-mul64/divsf3.S new file +274 -0

91 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600-mul64/muldf3.S new file +234 -0

234 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600-mul64/mulsf3.S new file +180 -0

180 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600/divsf3.S new file +227 -0

227 lines not on this page · raw message

arch/arc/lib/ieee-754/arc600/mulsf3.S new file +179 -0

179 lines not on this page · raw message

arch/arc/lib/ieee-754/divdf3.S new file +435 -0

435 lines not on this page · raw message

arch/arc/lib/ieee-754/divsf3-stdmul.S new file +281 -0

281 lines not on this page · raw message

arch/arc/lib/ieee-754/divsf3.S new file +221 -0

221 lines not on this page · raw message

arch/arc/lib/ieee-754/divtab-arc-df.c new file +161 -0

161 lines not on this page · raw message

arch/arc/lib/ieee-754/divtab-arc-sf.c new file +127 -0

127 lines not on this page · raw message

arch/arc/lib/ieee-754/eqdf2.S new file +81 -0

81 lines not on this page · raw message

arch/arc/lib/ieee-754/eqsf2.S new file +69 -0

69 lines not on this page · raw message

arch/arc/lib/ieee-754/extendsfdf2.S new file +122 -0

122 lines not on this page · raw message

arch/arc/lib/ieee-754/fixdfsi.S new file +85 -0

85 lines not on this page · raw message

arch/arc/lib/ieee-754/fixsfsi.S new file +71 -0

71 lines not on this page · raw message

arch/arc/lib/ieee-754/fixunsdfsi.S new file +80 -0

80 lines not on this page · raw message

arch/arc/lib/ieee-754/floatsidf.S new file +77 -0

77 lines not on this page · raw message

arch/arc/lib/ieee-754/floatsisf.S new file +99 -0

99 lines not on this page · raw message

arch/arc/lib/ieee-754/floatunsidf.S new file +75 -0

75 lines not on this page · raw message

arch/arc/lib/ieee-754/gedf2.S new file +86 -0

86 lines not on this page · raw message

arch/arc/lib/ieee-754/gesf2.S new file +75 -0

75 lines not on this page · raw message

arch/arc/lib/ieee-754/gtdf2.S new file +86 -0

86 lines not on this page · raw message

arch/arc/lib/ieee-754/gtsf2.S new file +75 -0

75 lines not on this page · raw message

arch/arc/lib/ieee-754/muldf3.S new file +235 -0

235 lines not on this page · raw message

arch/arc/lib/ieee-754/mulsf3.S new file +180 -0

180 lines not on this page · raw message

arch/arc/lib/ieee-754/orddf2.S new file +63 -0

63 lines not on this page · raw message

arch/arc/lib/ieee-754/ordsf2.S new file +63 -0

63 lines not on this page · raw message

arch/arc/lib/ieee-754/truncdfsf2.S new file +134 -0

134 lines not on this page · raw message

arch/arc/lib/ieee-754/uneqdf2.S new file +73 -0

73 lines not on this page · raw message

arch/arc/lib/ieee-754/uneqsf2.S new file +69 -0

69 lines not on this page · raw message

arch/arc/lib/lib1funcs.S new file +1430 -0

1,430 lines not on this page · raw message

arch/arc/lib/libgcc2.c +0 -84

84 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.0

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH 1/1 ARC: Import entire libgcc from GCC 8.1.0

Quoted 65 lines · Alexey Brodkin

Some background on private libgcc on ARC first.

The whole point of having private libgcc in U-Boot is to be toolchain agnostic. I.e. have an ability to use any more or less up-to-date ARC GNU tools for building U-Boot for any platform with ARC core.

As of today we have at least 6 (sic!) flavors of GNU toolchains for ARC.
1. Little-endian multilib Elf32
2. Big-endian multilib Elf32
3. Little-endian uClibc for ARC700 (ARCompact or ARCv1 ISA)
4. Big-endian uClibc for ARC700
5. Little-endian uClibc for ARC HS (ARCv2 ISA)
6. Big-endian uClibc for ARC HS

In foreseeable future we'll have multilib Linux toolchain so we'll cut number of tools down to 4. Anyways...

In general we don't need Linux toolchain for building U-Boot and since Elf32 GNU tools have libs for most of "standard" ARC core templates [1] it might be a good toolchain for U-Boot. But:
1. Still big-/little-endian platforms require different tools
2. Developers need to have Linux toolchain for user-space stuff because of C-library
3. People tend to build more Linux tools, like Linux kernel crootools

So it looks like multilib Linux toolchain might be a bit more convenient option, at least it addresses (2) and (3) from above, i.e. we'll only need to deal with big-/little-endian story and that should be fine as not that many developers in the world play simultaneously with platforms of both types.

But no! Linux multilib toolchain will only be built for very limited list of mcpu's [2]. Basically only "arc700" and "archs" (with few flavors for HS38 templates). That's because only those cores are capable of running Linux and uClibc/glibc couldn't be built for others. I.e. all the simpler cores where U-Boot could be perfectly used [and in fact is used more and more] won't have libgcc pre-built as the part of the toolchain.

And really ultimate solution is to build libgcc as a part of U-Boot and have no external dependencies. That's something that we used to do for quite some time [3] with limited amount of functions really required by existing platforms. But with addition of more platforms like those with missing multiplier (MPY and friends) we need to have more libgcc functions and to make things simple and at the same time very optimal we're importing entire libgcc for ARC from latest stable GCC (8.1.0 as of today).

[1] https://github.com/gcc-mirror/gcc/blob/master/gcc/config/arc/t-multilib#L24
[2] https://github.com/gcc-mirror/gcc/blob/master/gcc/config/arc/t-multilib-linux#L19
[3] http://git.denx.de/?p=u-boot.git;a=commit;h=a67ef280f46803e319639f5380ff8da6c6b7fbe7

---

Since that's an import from GCC I intentionally didn't do any changes to imported files. And that means checkpatch.pl is pretty unhappy. In particular because:
1. SPDX license header is missing
2. Some identation made with spaces
3. Spaces are missing in code or there're more than needed
4. A couple of "#if 0"
etc etc.

Quoted 3 lines

And that poses a question: what is mandatory to be fixed and what not?

1. I guess SPDX license header MUST be inserted, right?

Yes. And this is what we've done for other GCC imports as well btw.

Quoted 2 lines

2. All the rest I'd really like to keep as it is now to simplify subsequent updates of newer libgcc versions.

Yes, leaving the style otherwise non-matching is OK.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180608/ae87936d/attachment.sig>