Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Error while compiling kernel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Tom_
Guru
Guru


Joined: 20 May 2004
Posts: 448
Location: France

PostPosted: Mon Aug 19, 2024 10:57 am    Post subject: Error while compiling kernel Reply with quote

Hello,

I haven't been able to compile a kernel (tring 5.4.281) for a while.

The "make -j5" command ends like this :

Code:
  DESCEND  objtool
  CALL    scripts/atomic/check-atomics.sh
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Building modules, stage 2.
  MODPOST 93 modules
  LD      arch/x86/boot/compressed/vmlinux
ld: arch/x86/boot/compressed/head_64.o: warning: relocation in read-only section `.head.text'
ld: read-only segment has dynamic relocations
make[2]: *** [arch/x86/boot/compressed/Makefile:124: arch/x86/boot/compressed/vmlinux] Error 1
make[1]: *** [arch/x86/boot/Makefile:112: arch/x86/boot/compressed/vmlinux] Error 2
make: *** [arch/x86/Makefile:288: bzImage] Error 2
make: *** Waiting for unfinished jobs....


Have you ever faced this kind of error ? I don't know what to do. Is this related the compression part ? Or the compilation itself ?

gcc and glibc use flags :

Code:
thomas@gentoo ~ % equery uses gcc glibc
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for sys-devel/gcc-13.3.1_p20240614:
 U I
 - - ada       : Build the ADA language (GNAT) frontend
 + + cet       : (Restricted to >=sys-devel/gcc-10)
                 Enable support for control flow hijacking protection. On amd64, this provides Intel Control Flow Enforcement Technology (CET). On arm64, this provides Branch Target Identification (BTI) and Pointer Authentication Code (PAC) support. This is only effective on amd64 or arm64. Only provides benefits on newer CPUs. For Intel, the CPU must be at least as new as
                 Tiger Lake. For AMD, it must be at least as new as Zen 3. This is harmless on older CPUs, but provides no benefit either. For ARM64, PAC was introduced in armv8.3-a, and BTI was introduced in armv8.5-a. When combined with USE=hardened on amd64, GCC will set -fcf-protection by default when building software. The effect is minimal on systems which do not support
                 it, other than a possible small increase in codesize for the NOPs. The generated code is therefore compatible with i686 at the earliest. On arm64, GCC will set -mbranch-protection=standard by default when building software.
 - - d         : Enable support for the D programming language
 - - debug     : Enables GCC's 'checking' facility via --enable-checking=yes,extra,rtl. This adds checks to various compiler passes for integrity and input validation. This can help catch possible miscompilations early as well as latent bugs which could become real problems in future, but at the cost of slower compile times when using GCC. Unrelated to backtraces.
 - - doc       : Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
 + + fortran   : Add support for fortran
 - - go        : Build the GCC Go language frontend.
 + + graphite  : Add support for the framework for loop optimizations based on a polyhedral intermediate representation
 + + hardened  : Activate default security enhancements for toolchain (gcc, glibc, binutils)
 - - jit       : Enable libgccjit so other applications can embed gcc for Just-In-Time compilation.
 + + lto       : Build using Link Time Optimizations (LTO). Note that GCC is always built with support for building other programs with LTO. This USE flag is for whether GCC itself is built and optimized with LTO.
 - - modula2   : Build the GCC Modula-2 language frontend.
 + + nls       : Add Native Language Support (using gettext - GNU locale utilities)
 - - objc      : Build support for the Objective C code language
 - - objc++    : Build support for the Objective C++ language
 - - objc-gc   : Build support for the Objective C code language Garbage Collector
 + + openmp    : Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp"
 - - pgo       : Build GCC using Profile Guided Optimization (PGO). GCC will build itself and then analyze the just-built binary and then rebuild itself using the data obtained from analysis of codepaths taken. It does not affect whether GCC itself supports PGO when building other software. This substantially increases the build time needed for building GCC itself.
 + + sanitize  : Build support for various sanitizer functions (ASAN/TSAN/etc...) to find runtime problems in applications.
 + + ssp       : Build packages with stack smashing protection on by default
 - - systemtap : enable systemtap static probe points
 - - test      : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
 - - valgrind  : Enable annotations for accuracy. May slow down runtime slightly. Safe to use even if not currently using dev-debug/valgrind
 - - vanilla   : Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the meaning changes drastically
 - - vtv       : Build support for virtual table verification (a C++ hardening feature). This does not control whether GCC defaults to using VTV> Note that actually using VTV breaks ABI and hence the whole system must be built with -fvtable-verify.
 + + zstd      : Enable support for ZSTD compression

 * Found these USE flags for sys-libs/glibc-2.39-r6:
 U I
 - - audit              : Enable support for Linux audit subsystem using sys-process/audit
 - - caps               : Use Linux capabilities library to control privilege
 + + cet                : Enable Intel Control-flow Enforcement Technology (needs binutils 2.29 and gcc 8)
 - - compile-locales    : build *all* locales in src_install; this is generally meant for stage building only as it ignores /etc/locale.gen file and can be pretty slow
 - - doc                : Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
 - - gd                 : build memusage and memusagestat tools
 - - hash-sysv-compat   : enable sysv linker hashes in glibc for compatibility with binary software (EAC via wine/proton)
 - - headers-only       : Install only C headers instead of whole package. Mainly used by sys-devel/crossdev for toolchain bootstrap.
 + + multiarch          : enable optimizations for multiple CPU architectures (detected at runtime)
 - - multilib-bootstrap : Provide prebuilt libgcc.a and crt files if missing. Only needed for ABI switch.
 - - nscd               : Build, and enable support for, the Name Service Cache Daemon
 - - perl               : Install additional scripts written in Perl
 - - profile            : Add support for software performance analysis (will likely vary from ebuild to ebuild)
 + + ssp                : protect stack of glibc internals
 + + stack-realign      : Realign the stack in the 32-bit build for compatibility with older binaries at some performance cost
 - - suid               : Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5
 - - systemd            : Enable use of systemd-specific libraries and features like socket activation or session tracking
 - - systemtap          : enable systemtap static probe points
 - - test               : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)



emerge --info : https://bpa.st/N7XQ

Thank you in advance

Thomas
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1956
Location: 127.0.0.1

PostPosted: Mon Aug 19, 2024 11:31 am    Post subject: Reply with quote

Hi,

You see this kinds of errors with binutils >= 2.41 :
Code:

sys-devel/binutils:        2.41-r5::gentoo, 2.42-r1::gentoo

You should try to add :
Code:

-Wl,-z,notext

to your LDFLAGS on the make command line.
See this bug, you will find some packages that were fixed for this error.
Back to top
View user's profile Send private message
Tom_
Guru
Guru


Joined: 20 May 2004
Posts: 448
Location: France

PostPosted: Mon Aug 19, 2024 12:02 pm    Post subject: Reply with quote

Hi,

Thank you a lot! I was only looking into kernel related issues, not more global ones like binutils stuff!

Adding "KBUILD_LDFLAGS += -z notext" in arch/x86/boot/compressed/Makefile allowed me to complete the kernel build.

I don't really how to solve this issue once and for all Should I open a bug request for this ?

Thomas
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1956
Location: 127.0.0.1

PostPosted: Mon Aug 19, 2024 12:34 pm    Post subject: Reply with quote

There is already a bug : https://bugzilla.kernel.org/show_bug.cgi?id=204495
It was opened years ago because of this warning.
Unfortunately, with years this warning transmuted itself to an error.
Maybe you should ping everyone in this bug, and explain your case with your specs.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum