Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP4:RebuildFactoryUpdates
gcc7
gcc7-pfe-0020-Backport-varasm-Fix-up-__patchabl...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gcc7-pfe-0020-Backport-varasm-Fix-up-__patchable_function_entries-.patch of Package gcc7
From 686af21802e691f3b08cc45a5cb2c961b9676675 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek <jakub@redhat.com> Date: Wed, 16 Dec 2020 16:15:35 +0100 Subject: [PATCH 20/22] Backport varasm: Fix up __patchable_function_entries handling The SECTION_LINK_ORDER changes don't seem to work properly. If I compile: static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((patchable_function_entry(0, 0))) int foo (int x) { return x + 1; } static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((patchable_function_entry(0, 0))) int bar (int x) { return x + 2; } int baz (int x) { return foo (x) + 1; } int qux (int x) { return bar (x) + 2; } (distilled from aarch64 Linux kernel) with -O2 -fpatchable-function-entry=2 on aarch64 compiler configured against latest binutils, I get: ... .section __patchable_function_entries,"awo",@progbits,baz ... .section __patchable_function_entries ... in the assembly, but when it is assembled, one gets: [ 4] __patchable_function_entries PROGBITS 0000000000000000 000060 000008 00 WAL 1 0 8 [ 5] .rela__patchable_function_entries RELA 0000000000000000 000280 000018 18 I 12 4 8 [ 6] __patchable_function_entries PROGBITS 0000000000000000 000068 000008 00 0 0 8 [ 7] .rela__patchable_function_entries RELA 0000000000000000 000298 000018 18 I 12 6 8 i.e. one writable allocated section with SHF_LINK_ORDER and another non-allocated non-writable without link order. In the kernel case there is always one entry in the WAL section and then dozens or more in the non-allocated one. The kernel then fails to link: WARNING: modpost: vmlinux.o (__patchable_function_entries): unexpected non-allocatable section. Did you forget to use "ax"/"aw" in a .S file? Note that for example <linux/init.h> contains section definitions for use in .S files. ld: .init.data has both ordered [`__patchable_function_entries' in init/main.o] and unordered [`.init.data' in +./drivers/firmware/efi/libstub/vsprintf.stub.o] sections ld: final link failed: bad value make: *** [Makefile:1175: vmlinux] Error 1 The following patch fixes it by always forcing full section flags for SECTION_LINK_ORDER sections. 2020-12-16 Jakub Jelinek <jakub@redhat.com> * varasm.c (default_elf_asm_named_section): Always force section flags even for sections with SECTION_LINK_ORDER flag. --- gcc/varasm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/varasm.c b/gcc/varasm.c index 7b0792ddaed..9e0e7c0976f 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6363,9 +6363,10 @@ default_elf_asm_named_section (const char *name, unsigned int flags, /* If we have already declared this section, we can use an abbreviated form to switch back to it -- unless this section is - part of a COMDAT groups, in which case GAS requires the full - declaration every time. */ + part of a COMDAT groups or with SHF_GNU_RETAIN or with SHF_LINK_ORDER, + in which case GAS requires the full declaration every time. */ if (!(HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE)) + && !(flags & (SECTION_RETAIN | SECTION_LINK_ORDER)) && (flags & SECTION_DECLARED)) { fprintf (asm_out_file, "\t.section\t%s\n", name); -- 2.33.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor