Skip to content

Commit

Permalink
Merge branch 'master' into centos7-build
Browse files Browse the repository at this point in the history
  • Loading branch information
tienntr committed Dec 15, 2023
2 parents 01bb13b + 99e2d2b commit efbff51
Show file tree
Hide file tree
Showing 484 changed files with 37,784 additions and 9,755 deletions.
2 changes: 1 addition & 1 deletion .github/setup-apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ apt update
apt install -y autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev \
libgmp-dev gawk build-essential bison flex texinfo gperf libtool \
patchutils bc zlib1g-dev libexpat-dev git ninja-build cmake libglib2.0-dev expect \
device-tree-compiler
device-tree-compiler python3-pyelftools
11 changes: 4 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: make report
if: |
matrix.os == 'ubuntu-20.04'
matrix.os == 'ubuntu-22.04'
&& (matrix.mode == 'linux' || matrix.mode == 'newlib')
&& matrix.compiler == 'gcc'
run: |
Expand Down Expand Up @@ -88,13 +88,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
mode: [newlib, linux]
os: [ubuntu-22.04]
mode: [newlib]
target: [rv64gc-lp64d]
sim: [spike]
exclude:
- sim: spike
mode: linux
steps:
- name: Remove unneeded frameworks to recover disk space
run: |
Expand Down Expand Up @@ -124,7 +121,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]
mode: [newlib, linux]
target: [rv64gc-lp64d]
steps:
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "binutils"]
path = binutils
url = https://sourceware.org/git/binutils-gdb.git
branch = binutils-2_40-branch
branch = binutils-2_41-release-point
[submodule "gcc"]
path = gcc
url = https://gcc.gnu.org/git/gcc.git
Expand Down Expand Up @@ -39,4 +39,4 @@
[submodule "llvm"]
path = llvm
url = https://github.com/llvm/llvm-project.git
branch = release/15.x
branch = release/17.x
32 changes: 21 additions & 11 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ifeq ($(MULTILIB_GEN),)
NEWLIB_MULTILIB_NAMES := @newlib_multilib_names@
GCC_MULTILIB_FLAGS := $(MULTILIB_FLAGS)
else
NEWLIB_MULTILIB_NAMES := $(shell echo "$(MULTILIB_GEN)" | $(SED) 's/;/\n/g'| $(AWK) '{split($$0,a,"-"); printf "%s-%s ", a[1],a[2]}')
NEWLIB_MULTILIB_NAMES := $(shell echo "$(MULTILIB_GEN)" | $(SED) 's/;/\n/g' | $(SED) '/^$$/d' | $(AWK) '{split($$0,a,"-"); printf "%s-%s ", a[1],a[2]}')
GCC_MULTILIB_FLAGS := $(MULTILIB_FLAGS) --with-multilib-generator="$(MULTILIB_GEN)"
endif
GLIBC_MULTILIB_NAMES := @glibc_multilib_names@
Expand Down Expand Up @@ -93,12 +93,25 @@ GDB_NATIVE_FLAGS := $(GDB_NATIVE_FLAGS_EXTRA)
GLIBC_TARGET_FLAGS := $(GLIBC_TARGET_FLAGS_EXTRA)
GLIBC_CC_FOR_TARGET ?= $(LINUX_TUPLE)-gcc
GLIBC_CXX_FOR_TARGET ?= $(LINUX_TUPLE)-g++
GLIBC_TARGET_BOARDS ?= $(shell echo "$(GLIBC_MULTILIB_NAMES) $(EXTRA_MULTILIB_TEST)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim/-march=\1/-mabi=\2/@cmodel@!g')
GLIBC_TARGET_BOARDS ?= $(shell $(srcdir)/scripts/generate_target_board \
--sim-name riscv-sim \
--cmodel $(shell echo @cmodel@ | cut -d '=' -f2) \
--build-arch-abi $(GLIBC_MULTILIB_NAMES) \
--extra-test-arch-abi-flags-list "$(EXTRA_MULTILIB_TEST)")

NEWLIB_CC_FOR_TARGET ?= $(NEWLIB_TUPLE)-gcc
NEWLIB_CXX_FOR_TARGET ?= $(NEWLIB_TUPLE)-g++
NEWLIB_TARGET_BOARDS ?= $(shell echo "$(NEWLIB_MULTILIB_NAMES) $(EXTRA_MULTILIB_TEST)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim/-march=\1/-mabi=\2/@cmodel@!g')
NEWLIB_NANO_TARGET_BOARDS ?= $(shell echo "$(NEWLIB_MULTILIB_NAMES) $(EXTRA_MULTILIB_TEST)" | sed 's!\([_a-z0-9]*\)-\([_a-z0-9]*\)!riscv-sim-nano/-march=\1/-mabi=\2/@cmodel@!g')
NEWLIB_TARGET_BOARDS ?= $(shell $(srcdir)/scripts/generate_target_board \
--sim-name riscv-sim \
--cmodel $(shell echo @cmodel@ | cut -d '=' -f2) \
--build-arch-abi $(NEWLIB_MULTILIB_NAMES) \
--extra-test-arch-abi-flags-list "$(EXTRA_MULTILIB_TEST)")

NEWLIB_NANO_TARGET_BOARDS ?= $(shell $(srcdir)/scripts/generate_target_board \
--sim-name riscv-sim-nano \
--cmodel $(shell echo @cmodel@ | cut -d '=' -f2) \
--build-arch-abi $(NEWLIB_MULTILIB_NAMES) \
--extra-test-arch-abi-flags-list "$(EXTRA_MULTILIB_TEST)")
NEWLIB_CC_FOR_MULTILIB_INFO := $(NEWLIB_CC_FOR_TARGET)

MUSL_TARGET_FLAGS := $(MUSL_TARGET_FLAGS_EXTRA)
Expand Down Expand Up @@ -191,11 +204,11 @@ report-gdb: report-gdb-@default_target@
ifeq ($(SIM),qemu)
SIM_PATH:=$(srcdir)/scripts/wrapper/qemu:$(srcdir)/scripts
SIM_PREPARE:=PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)"
SIM_STAMP:= stamps/build-qemu stamps/install-python-package
SIM_STAMP:= stamps/build-qemu
else
ifeq ($(SIM),spike)
# Using spike simulator.
SIM_PATH:=$(srcdir)/scripts/wrapper/spike
SIM_PATH:=$(srcdir)/scripts/wrapper/spike:$(srcdir)/scripts
SIM_PREPARE:=PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" PK_PATH="$(INSTALL_DIR)/$(NEWLIB_TUPLE)/bin/" ARCH_STR="$(WITH_ARCH)"
SIM_STAMP:= stamps/build-spike
ifneq (,$(findstring rv32,$(NEWLIB_MULTILIB_NAMES)))
Expand Down Expand Up @@ -893,10 +906,6 @@ stamps/build-pk64: $(PK_SRCDIR) $(PK_SRC_GIT) stamps/build-gcc-newlib-stage2
mkdir -p $(dir $@)
date > $@

stamps/install-python-package:
python3 -m pip install --user pyelftools
date > $@

stamps/build-qemu: $(QEMU_SRCDIR) $(QEMU_SRC_GIT)
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
Expand Down Expand Up @@ -987,7 +996,8 @@ stamps/check-gcc-linux: stamps/build-gcc-linux-stage2 $(SIM_STAMP) stamps/build-
mkdir -p $(dir $@)
date > $@

stamps/check-glibc-linux-%: $(addprefix stamps/build-glibc-linux-,$(GLIBC_MULTILIB_NAMES))
stamps/check-glibc-linux-%: stamps/build-gcc-linux-stage2 $(SIM_STAMP) stamps/build-dejagnu \
$(addprefix stamps/build-glibc-linux-,$(GLIBC_MULTILIB_NAMES))
$(eval $@_BUILD_DIR := $(notdir $@))
$(eval $@_BUILD_DIR := $(subst check-,build-,$($@_BUILD_DIR)))
$(SIM_PREPARE) $(MAKE) -C $($@_BUILD_DIR) check
Expand Down
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,34 @@ by the SIM variable in the Makefile, e.g. SIM=qemu, SIM=gdb, or SIM=spike
(experimental).In addition, the simulator can also be selected with the
configure time option `--with-sim=`.However, the testsuite allowlist is
only mintained for qemu.Other simulators might get extra failures.

#### Additional Prerequisite

A helper script to setup testing environment requires
[pyelftools](https://github.com/eliben/pyelftools).

On newer versions of Ubuntu, executing the following command
should suffice:

$ sudo apt-get install python3-pyelftools

On newer versions of Fedora and CentOS/RHEL OS (9 or later), executing
the following command should suffice:

$ sudo yum install python3-pyelftools

On Arch Linux, executing the following command should suffice:

$ sudo pacman -Syyu python-pyelftools

If your distribution/OS does not have pyelftools package, you can install
it using PIP.

# Assuming that PIP is installed
$ pip3 install --user pyelftools

#### Testing GCC

To test GCC, run the following commands:

./configure --prefix=$RISCV --disable-linux --with-arch=rv64ima # or --with-arch=rv32ima
Expand Down Expand Up @@ -261,6 +289,60 @@ even multilib is disable, but the user must ensure extra multilib test
configuration can be work with existing lib/multilib, e.g. rv32gcv/ilp32 test
can't work if multilib didn't have any rv32 multilib.

`--with-extra-multilib-test` also support more complicated format to fit the
requirements of end-users. First of all, the argument is a list of test
configurations. Each test configuration are separated by `;`. For example:

`rv64gcv-lp64d;rv64_zvl256b_zvfh-lp64d`

For each test configuration, it has two parts, aka required arch-abi part and
optional build flags. We leverage `:` to separate them with some restrictions.

* arch-abi should be required and there must be only one at the begining of
the test configuration.
* build flags is a array-like flags after the arch-abi, there will be two
ways to arrange them, aka AND, OR operation.
* If you would like the flags in build flags array acts on arch-abi
__simultaneously__, you can use `:` to separate them. For example:

```
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax
```

will be consider as one target board same as below:

```
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic/--param=riscv-autovec-preference=fixed-vlmax
```

* If you would like the flags in build flags array acts on arch-abi
__respectively__, you can use ',' to separate them. For example:

```
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic,--param=riscv-autovec-preference=fixed-vlmax
```

will be consider as two target boards same as below:

```
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-preference=fixed-vlmax
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic
```

* However, you can also leverage AND(`:`), OR(`,`) operator together but the
OR(`,`) will always have the higher priority. For example:

```
rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax,--param=riscv-autovec-lmul=m2
```

will be consider as tow target boars same as below:

```
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic/--param=riscv-autovec-preference=fixed-vlmax
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=m2
```

### LLVM / clang

LLVM can be used in combination with the RISC-V GNU Compiler Toolchain
Expand Down
2 changes: 1 addition & 1 deletion binutils
Submodule binutils updated from 675b9d to 49f611
2 changes: 1 addition & 1 deletion glibc
Submodule glibc updated from a704fd to 36f248
13 changes: 12 additions & 1 deletion linux-headers/include/asm-generic/bitsperlong.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@
#ifndef __ASM_GENERIC_BITS_PER_LONG
#define __ASM_GENERIC_BITS_PER_LONG

#ifndef __BITS_PER_LONG
/*
* In order to keep safe and avoid regression, only unify uapi
* bitsperlong.h for some archs which are using newer toolchains
* that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__.
* See the following link for more info:
* https://lore.kernel.org/linux-arch/[email protected]/
*/
#if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__)
#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
#else
/*
* There seems to be no way of detecting this automatically from user
* space, so 64 bit architectures should override this in their
* bitsperlong.h. In particular, an architecture that supports
* both 32 and 64 bit user space must not rely on CONFIG_64BIT
* to decide it, but rather check a compiler provided macro.
*/
#ifndef __BITS_PER_LONG
#define __BITS_PER_LONG 32
#endif
#endif

#endif /* __ASM_GENERIC_BITS_PER_LONG */
28 changes: 14 additions & 14 deletions linux-headers/include/asm-generic/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@

/* a horrid kludge trying to make sure that this will fail on old kernels */
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)

#ifndef O_NDELAY
#define O_NDELAY O_NONBLOCK
Expand All @@ -116,13 +115,13 @@
#define F_GETSIG 11 /* for sockets. */
#endif

#ifndef CONFIG_64BIT
#if __BITS_PER_LONG == 32 || defined(__KERNEL__)
#ifndef F_GETLK64
#define F_GETLK64 12 /* using 'struct flock64' */
#define F_SETLK64 13
#define F_SETLKW64 14
#endif
#endif
#endif /* __BITS_PER_LONG == 32 || defined(__KERNEL__) */

#ifndef F_SETOWN_EX
#define F_SETOWN_EX 15
Expand Down Expand Up @@ -181,6 +180,10 @@ struct f_owner_ex {
blocking */
#define LOCK_UN 8 /* remove lock */

/*
* LOCK_MAND support has been removed from the kernel. We leave the symbols
* here to not break legacy builds, but these should not be used in new code.
*/
#define LOCK_MAND 32 /* This is a mandatory flock ... */
#define LOCK_READ 64 /* which allows concurrent read operations */
#define LOCK_WRITE 128 /* which allows concurrent write operations */
Expand All @@ -189,33 +192,30 @@ struct f_owner_ex {
#define F_LINUX_SPECIFIC_BASE 1024

#ifndef HAVE_ARCH_STRUCT_FLOCK
#ifndef __ARCH_FLOCK_PAD
#define __ARCH_FLOCK_PAD
#endif

struct flock {
short l_type;
short l_whence;
__kernel_off_t l_start;
__kernel_off_t l_len;
__kernel_pid_t l_pid;
__ARCH_FLOCK_PAD
};
#ifdef __ARCH_FLOCK_EXTRA_SYSID
__ARCH_FLOCK_EXTRA_SYSID
#endif

#ifndef HAVE_ARCH_STRUCT_FLOCK64
#ifndef __ARCH_FLOCK64_PAD
#define __ARCH_FLOCK64_PAD
#ifdef __ARCH_FLOCK_PAD
__ARCH_FLOCK_PAD
#endif
};

struct flock64 {
short l_type;
short l_whence;
__kernel_loff_t l_start;
__kernel_loff_t l_len;
__kernel_pid_t l_pid;
#ifdef __ARCH_FLOCK64_PAD
__ARCH_FLOCK64_PAD
};
#endif
};
#endif /* HAVE_ARCH_STRUCT_FLOCK */

#endif /* _ASM_GENERIC_FCNTL_H */
26 changes: 13 additions & 13 deletions linux-headers/include/asm-generic/hugetlb_encode.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
#define HUGETLB_FLAG_ENCODE_SHIFT 26
#define HUGETLB_FLAG_ENCODE_MASK 0x3f

#define HUGETLB_FLAG_ENCODE_16KB (14 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_16KB (14U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_64KB (16U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_512KB (19U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_1MB (20U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_2MB (21U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_8MB (23U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_16MB (24U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_32MB (25U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_256MB (28U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_512MB (29U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_1GB (30U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_2GB (31U << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_16GB (34U << HUGETLB_FLAG_ENCODE_SHIFT)

#endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
7 changes: 7 additions & 0 deletions linux-headers/include/asm-generic/mman-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
#define MADV_COLD 20 /* deactivate these pages */
#define MADV_PAGEOUT 21 /* reclaim these pages */

#define MADV_POPULATE_READ 22 /* populate (prefault) page tables readable */
#define MADV_POPULATE_WRITE 23 /* populate (prefault) page tables writable */

#define MADV_DONTNEED_LOCKED 24 /* like DONTNEED, but drop locked pages too */

#define MADV_COLLAPSE 25 /* Synchronous hugepage collapse */

/* compatibility flags */
#define MAP_FILE 0

Expand Down
2 changes: 1 addition & 1 deletion linux-headers/include/asm-generic/poll.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define POLLRDHUP 0x2000
#endif

#define POLLFREE (__poll_t)0x4000 /* currently only for epoll */
#define POLLFREE (__poll_t)0x4000

#define POLL_BUSY_LOOP (__poll_t)0x8000

Expand Down
Loading

0 comments on commit efbff51

Please sign in to comment.