Skip to content

Commit

Permalink
chore: update tools
Browse files Browse the repository at this point in the history
This updates tools to reproducible build enabled ones, bumps toolchain
indirectly.

Build fixes related to changes in tools/toolchain.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Sep 1, 2021
1 parent a243ab8 commit 982bc18
Show file tree
Hide file tree
Showing 13 changed files with 314 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Pkgfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
format: v1alpha2

vars:
TOOLS_IMAGE: ghcr.io/talos-systems/tools:v0.8.0-alpha.0
TOOLS_IMAGE: ghcr.io/talos-systems/tools:v0.8.0-alpha.0-2-g5b9d214

labels:
org.opencontainers.image.source: https://github.com/talos-systems/pkgs
2 changes: 1 addition & 1 deletion grub/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ steps:
- |
tar -xJf grub.tar.xz --strip-components=1
/toolchain/bin/bash ./autogen.sh
PYTHON=python3 /toolchain/bin/bash ./autogen.sh
patch -p1 < /pkg/patches/udev.patch
patch -p1 < /pkg/patches/efi-fat-serial-number.patch
Expand Down
205 changes: 205 additions & 0 deletions ipxe/patches/bigint.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
diff --git a/src/arch/x86/core/x86_bigint.c b/src/arch/x86/core/x86_bigint.c
index 6413b2fa8c..9a25bdad58 100644
--- a/src/arch/x86/core/x86_bigint.c
+++ b/src/arch/x86/core/x86_bigint.c
@@ -75,17 +75,18 @@ void bigint_multiply_raw ( const uint32_t *multiplicand0,
*
* a < 2^{n}, b < 2^{n} => ab < 2^{2n}
*/
- __asm__ __volatile__ ( "mull %4\n\t"
- "addl %%eax, (%5,%2,4)\n\t"
- "adcl %%edx, 4(%5,%2,4)\n\t"
+ __asm__ __volatile__ ( "mull %5\n\t"
+ "addl %%eax, (%6,%2,4)\n\t"
+ "adcl %%edx, 4(%6,%2,4)\n\t"
"\n1:\n\t"
- "adcl $0, 8(%5,%2,4)\n\t"
+ "adcl $0, 8(%6,%2,4)\n\t"
"inc %2\n\t"
/* Does not affect CF */
"jc 1b\n\t"
: "=&a" ( discard_a ),
"=&d" ( discard_d ),
- "=&r" ( index )
+ "=&r" ( index ),
+ "+m" ( *result )
: "0" ( multiplicand_element ),
"g" ( multiplier_element ),
"r" ( result_elements ),
diff --git a/src/arch/x86/include/bits/bigint.h b/src/arch/x86/include/bits/bigint.h
index 4f1bc87ffe..7443d6fdcd 100644
--- a/src/arch/x86/include/bits/bigint.h
+++ b/src/arch/x86/include/bits/bigint.h
@@ -25,19 +25,22 @@ typedef uint32_t bigint_element_t;
static inline __attribute__ (( always_inline )) void
bigint_init_raw ( uint32_t *value0, unsigned int size,
const void *data, size_t len ) {
- long pad_len = ( sizeof ( bigint_t ( size ) ) - len );
+ bigint_t ( size ) __attribute__ (( may_alias )) *value =
+ ( ( void * ) value0 );
+ long pad_len = ( sizeof ( *value ) - len );
void *discard_D;
long discard_c;

/* Copy raw data in reverse order, padding with zeros */
__asm__ __volatile__ ( "\n1:\n\t"
- "movb -1(%2,%1), %%al\n\t"
+ "movb -1(%3,%1), %%al\n\t"
"stosb\n\t"
"loop 1b\n\t"
"xorl %%eax, %%eax\n\t"
- "mov %3, %1\n\t"
+ "mov %4, %1\n\t"
"rep stosb\n\t"
- : "=&D" ( discard_D ), "=&c" ( discard_c )
+ : "=&D" ( discard_D ), "=&c" ( discard_c ),
+ "+m" ( *value )
: "r" ( data ), "g" ( pad_len ), "0" ( value0 ),
"1" ( len )
: "eax" );
@@ -53,6 +56,8 @@ bigint_init_raw ( uint32_t *value0, unsigned int size,
static inline __attribute__ (( always_inline )) void
bigint_add_raw ( const uint32_t *addend0, uint32_t *value0,
unsigned int size ) {
+ bigint_t ( size ) __attribute__ (( may_alias )) *value =
+ ( ( void * ) value0 );
long index;
void *discard_S;
long discard_c;
@@ -60,11 +65,11 @@ bigint_add_raw ( const uint32_t *addend0, uint32_t *value0,
__asm__ __volatile__ ( "xor %0, %0\n\t" /* Zero %0 and clear CF */
"\n1:\n\t"
"lodsl\n\t"
- "adcl %%eax, (%3,%0,4)\n\t"
+ "adcl %%eax, (%4,%0,4)\n\t"
"inc %0\n\t" /* Does not affect CF */
"loop 1b\n\t"
: "=&r" ( index ), "=&S" ( discard_S ),
- "=&c" ( discard_c )
+ "=&c" ( discard_c ), "+m" ( *value )
: "r" ( value0 ), "1" ( addend0 ), "2" ( size )
: "eax" );
}
@@ -79,6 +84,8 @@ bigint_add_raw ( const uint32_t *addend0, uint32_t *value0,
static inline __attribute__ (( always_inline )) void
bigint_subtract_raw ( const uint32_t *subtrahend0, uint32_t *value0,
unsigned int size ) {
+ bigint_t ( size ) __attribute__ (( may_alias )) *value =
+ ( ( void * ) value0 );
long index;
void *discard_S;
long discard_c;
@@ -86,11 +93,11 @@ bigint_subtract_raw ( const uint32_t *subtrahend0, uint32_t *value0,
__asm__ __volatile__ ( "xor %0, %0\n\t" /* Zero %0 and clear CF */
"\n1:\n\t"
"lodsl\n\t"
- "sbbl %%eax, (%3,%0,4)\n\t"
+ "sbbl %%eax, (%4,%0,4)\n\t"
"inc %0\n\t" /* Does not affect CF */
"loop 1b\n\t"
: "=&r" ( index ), "=&S" ( discard_S ),
- "=&c" ( discard_c )
+ "=&c" ( discard_c ), "+m" ( *value )
: "r" ( value0 ), "1" ( subtrahend0 ),
"2" ( size )
: "eax" );
@@ -104,15 +111,18 @@ bigint_subtract_raw ( const uint32_t *subtrahend0, uint32_t *value0,
*/
static inline __attribute__ (( always_inline )) void
bigint_rol_raw ( uint32_t *value0, unsigned int size ) {
+ bigint_t ( size ) __attribute__ (( may_alias )) *value =
+ ( ( void * ) value0 );
long index;
long discard_c;

__asm__ __volatile__ ( "xor %0, %0\n\t" /* Zero %0 and clear CF */
"\n1:\n\t"
- "rcll $1, (%2,%0,4)\n\t"
+ "rcll $1, (%3,%0,4)\n\t"
"inc %0\n\t" /* Does not affect CF */
"loop 1b\n\t"
- : "=&r" ( index ), "=&c" ( discard_c )
+ : "=&r" ( index ), "=&c" ( discard_c ),
+ "+m" ( *value )
: "r" ( value0 ), "1" ( size ) );
}

@@ -124,13 +134,15 @@ bigint_rol_raw ( uint32_t *value0, unsigned int size ) {
*/
static inline __attribute__ (( always_inline )) void
bigint_ror_raw ( uint32_t *value0, unsigned int size ) {
+ bigint_t ( size ) __attribute__ (( may_alias )) *value =
+ ( ( void * ) value0 );
long discard_c;

__asm__ __volatile__ ( "clc\n\t"
"\n1:\n\t"
- "rcrl $1, -4(%1,%0,4)\n\t"
+ "rcrl $1, -4(%2,%0,4)\n\t"
"loop 1b\n\t"
- : "=&c" ( discard_c )
+ : "=&c" ( discard_c ), "+m" ( *value )
: "r" ( value0 ), "0" ( size ) );
}

@@ -239,6 +251,8 @@ bigint_max_set_bit_raw ( const uint32_t *value0, unsigned int size ) {
static inline __attribute__ (( always_inline )) void
bigint_grow_raw ( const uint32_t *source0, unsigned int source_size,
uint32_t *dest0, unsigned int dest_size ) {
+ bigint_t ( dest_size ) __attribute__ (( may_alias )) *dest =
+ ( ( void * ) dest0 );
long pad_size = ( dest_size - source_size );
void *discard_D;
void *discard_S;
@@ -246,10 +260,10 @@ bigint_grow_raw ( const uint32_t *source0, unsigned int source_size,

__asm__ __volatile__ ( "rep movsl\n\t"
"xorl %%eax, %%eax\n\t"
- "mov %3, %2\n\t"
+ "mov %4, %2\n\t"
"rep stosl\n\t"
: "=&D" ( discard_D ), "=&S" ( discard_S ),
- "=&c" ( discard_c )
+ "=&c" ( discard_c ), "+m" ( *dest )
: "g" ( pad_size ), "0" ( dest0 ),
"1" ( source0 ), "2" ( source_size )
: "eax" );
@@ -266,13 +280,15 @@ bigint_grow_raw ( const uint32_t *source0, unsigned int source_size,
static inline __attribute__ (( always_inline )) void
bigint_shrink_raw ( const uint32_t *source0, unsigned int source_size __unused,
uint32_t *dest0, unsigned int dest_size ) {
+ bigint_t ( dest_size ) __attribute__ (( may_alias )) *dest =
+ ( ( void * ) dest0 );
void *discard_D;
void *discard_S;
long discard_c;

__asm__ __volatile__ ( "rep movsl\n\t"
: "=&D" ( discard_D ), "=&S" ( discard_S ),
- "=&c" ( discard_c )
+ "=&c" ( discard_c ), "+m" ( *dest )
: "0" ( dest0 ), "1" ( source0 ),
"2" ( dest_size )
: "eax" );
@@ -289,15 +305,19 @@ bigint_shrink_raw ( const uint32_t *source0, unsigned int source_size __unused,
static inline __attribute__ (( always_inline )) void
bigint_done_raw ( const uint32_t *value0, unsigned int size __unused,
void *out, size_t len ) {
+ struct {
+ uint8_t bytes[len];
+ } __attribute__ (( may_alias )) *out_bytes = out;
void *discard_D;
long discard_c;

/* Copy raw data in reverse order */
__asm__ __volatile__ ( "\n1:\n\t"
- "movb -1(%2,%1), %%al\n\t"
+ "movb -1(%3,%1), %%al\n\t"
"stosb\n\t"
"loop 1b\n\t"
- : "=&D" ( discard_D ), "=&c" ( discard_c )
+ : "=&D" ( discard_D ), "=&c" ( discard_c ),
+ "+m" ( *out_bytes )
: "r" ( value0 ), "0" ( out ), "1" ( len )
: "eax" );
}
27 changes: 27 additions & 0 deletions ipxe/patches/eeprom.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/src/drivers/net/ath/ath5k/ath5k_eeprom.c b/src/drivers/net/ath/ath5k/ath5k_eeprom.c
index 983d206b7e..12519bc599 100644
--- a/src/drivers/net/ath/ath5k/ath5k_eeprom.c
+++ b/src/drivers/net/ath/ath5k/ath5k_eeprom.c
@@ -416,6 +416,7 @@ ath5k_eeprom_read_turbo_modes(struct ath5k_hw *ah,
if (ee->ee_version < AR5K_EEPROM_VERSION_5_0)
return 0;

+ AR5K_EEPROM_READ(o++, val);
switch (mode){
case AR5K_EEPROM_MODE_11A:
ee->ee_switch_settling_turbo[mode] = (val >> 6) & 0x7f;

diff --git a/src/drivers/net/ath/ath5k/ath5k_eeprom.c b/src/drivers/net/ath/ath5k/ath5k_eeprom.c
index 12519bc599..46f33d1e8f 100644
--- a/src/drivers/net/ath/ath5k/ath5k_eeprom.c
+++ b/src/drivers/net/ath/ath5k/ath5k_eeprom.c
@@ -39,6 +39,9 @@ static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data)
{
u32 status, timeout;

+ /* Avoid returning uninitialised data on error */
+ *data = 0xffff;
+
/*
* Initialize EEPROM access
*/
4 changes: 3 additions & 1 deletion ipxe/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ steps:
- |
tar -xzf ipxe.tar.gz --strip-components=1
patch -p 1 < /pkg/patches/https.patch
patch -p1 < /pkg/patches/https.patch
patch -p1 < /pkg/patches/bigint.patch
patch -p1 < /pkg/patches/eeprom.patch
build:
- |
cd src/
Expand Down
29 changes: 29 additions & 0 deletions kernel/kernel-prepare/patches/gcc-plugins.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/scripts/gcc-plugin.sh b/scripts/gcc-plugin.sh
index b79fd0bea838..7abc00f60a8b 100755
--- a/scripts/gcc-plugin.sh
+++ b/scripts/gcc-plugin.sh
@@ -8,7 +8,7 @@ srctree=$(dirname "$0")
gccplugins_dir=$($* -print-file-name=plugin)

# we need a c++ compiler that supports the designated initializer GNU extension
-$HOSTCC -c -x c++ -std=gnu++98 - -fsyntax-only -I $srctree/gcc-plugins -I $gccplugins_dir/include 2>/dev/null <<EOF
+$HOSTCC -c -x c++ -std=gnu++11 - -fsyntax-only -I $srctree/gcc-plugins -I $gccplugins_dir/include 2>/dev/null <<EOF
#include "gcc-common.h"
class test {
public:
diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
index d66949bfeba4..b5487cce69e8 100644
--- a/scripts/gcc-plugins/Makefile
+++ b/scripts/gcc-plugins/Makefile
@@ -22,9 +22,9 @@ always-y += $(GCC_PLUGIN)
GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)

plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
- -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++98 \
+ -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \
-fno-rtti -fno-exceptions -fasynchronous-unwind-tables \
- -ggdb -Wno-narrowing -Wno-unused-variable -Wno-c++11-compat \
+ -ggdb -Wno-narrowing -Wno-unused-variable \
-Wno-format-diag

plugin_ldflags = -shared
2 changes: 2 additions & 0 deletions kernel/kernel-prepare/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ steps:
tar -xJf linux.tar.xz --strip-components=1
rm linux.tar.xz
patch -p1 < /pkg/patches/gcc-plugins.patch
mkdir /bin
ln -sv /toolchain/bin/bash /bin/bash
ln -sv /toolchain/bin/bash /bin/sh
Expand Down
9 changes: 6 additions & 3 deletions kernel/kernel/config-amd64
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.10.58 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 10.2.0"
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=100200
CONFIG_LD_VERSION=235000000
CONFIG_GCC_VERSION=110200
CONFIG_LD_VERSION=237000000
CONFIG_CLANG_VERSION=0
CONFIG_LLD_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_CAN_LINK_STATIC=y
CONFIG_CC_HAS_ASM_GOTO=y
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
Expand Down Expand Up @@ -5532,6 +5533,8 @@ CONFIG_HAVE_ARCH_KGDB=y
CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
# CONFIG_UBSAN is not set
CONFIG_HAVE_ARCH_KCSAN=y
CONFIG_HAVE_KCSAN_COMPILER=y
# CONFIG_KCSAN is not set
# end of Generic Kernel Debugging Instruments

CONFIG_DEBUG_KERNEL=y
Expand Down
9 changes: 6 additions & 3 deletions kernel/kernel/config-arm64
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 5.10.58 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 10.2.0"
CONFIG_CC_VERSION_TEXT="gcc (GCC) 11.2.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=100200
CONFIG_LD_VERSION=235000000
CONFIG_GCC_VERSION=110200
CONFIG_LD_VERSION=237000000
CONFIG_CLANG_VERSION=0
CONFIG_LLD_VERSION=0
CONFIG_CC_CAN_LINK=y
CONFIG_CC_CAN_LINK_STATIC=y
CONFIG_CC_HAS_ASM_GOTO=y
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
Expand Down Expand Up @@ -8034,6 +8035,7 @@ CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set
CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
# CONFIG_UBSAN is not set
CONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments

CONFIG_DEBUG_KERNEL=y
Expand Down Expand Up @@ -8072,6 +8074,7 @@ CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_HAVE_ARCH_KASAN=y
CONFIG_HAVE_ARCH_KASAN_SW_TAGS=y
CONFIG_CC_HAS_KASAN_GENERIC=y
CONFIG_CC_HAS_KASAN_SW_TAGS=y
CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y
# CONFIG_KASAN is not set
# end of Memory Debugging
Expand Down
1 change: 1 addition & 0 deletions kernel/kernel/scripts/filter-hardened-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'CONFIG_IA32_EMULATION', # see https://github.com/talos-systems/pkgs/pull/125
'CONFIG_HARDEN_BRANCH_PREDICTOR', # looks like a bug in kconfig-hardened-check, default in 5.9, but not enabled in 5.10
'CONFIG_INIT_ON_FREE_DEFAULT_ON', # disabled init_on_free=1 due to performance
'CONFIG_ARM64_EPAN', # not available in 5.10, first introduced in 5.13
}

def main():
Expand Down

0 comments on commit 982bc18

Please sign in to comment.