linux/include/asm-generic
Masahiro Yamada 4c56eb33e6 kbuild: keep symbols for symbol_get() even with CONFIG_TRIM_UNUSED_KSYMS
Linus observed that the symbol_request(utf8_data_table) call fails when
CONFIG_UNICODE=y and CONFIG_TRIM_UNUSED_KSYMS=y.

symbol_get() relies on the symbol data being present in the ksymtab for
symbol lookups. However, EXPORT_SYMBOL_GPL(utf8_data_table) is dropped
due to CONFIG_TRIM_UNUSED_KSYMS, as no module references it in this case.

Probably, this has been broken since commit dbacb0ef67 ("kconfig option
for TRIM_UNUSED_KSYMS").

This commit addresses the issue by leveraging modpost. Symbol names
passed to symbol_get() are recorded in the special .no_trim_symbol
section, which is then parsed by modpost to forcibly keep such symbols.
The .no_trim_symbol section is discarded by the linker scripts, so there
is no impact on the size of the final vmlinux or modules.

This commit cannot resolve the issue for direct calls to __symbol_get()
because the symbol name is not known at compile-time.

Although symbol_get() may eventually be deprecated, this workaround
should be good enough meanwhile.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-02-06 01:08:58 +09:00
..
bitops bitops: Change function return types from long to int 2024-05-03 17:04:50 +02:00
vdso vdso: Remove timekeeper argument of __arch_update_vsyscall() 2024-10-15 17:50:28 +02:00
Kbuild move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
access_ok.h
agp.h
archrandom.h
asm-offsets.h
asm-prototypes.h
atomic.h
atomic64.h
audit_change_attr.h fs/xattr: add *at family syscalls 2024-11-06 12:59:44 -05:00
audit_dir_write.h
audit_read.h
audit_signal.h
audit_write.h
barrier.h sched: Add missing memory barrier in switch_mm_cid 2024-04-16 13:59:45 +02:00
bitops.h
bitsperlong.h
bug.h bug: Improve comment 2024-05-07 14:20:48 +02:00
cache.h
cacheflush.h
cfi.h
checksum.h
cmpxchg-local.h
cmpxchg.h
codetag.lds.h alloc_tag: load module tags into separate contiguous memory 2024-11-07 14:25:16 -08:00
compat.h
current.h
delay.h delay: Fix ndelay() spuriously treated as udelay() 2024-11-29 11:40:22 +01:00
device.h
div64.h __arch_xprod64(): make __always_inline when optimizing for performance 2024-10-28 21:44:28 +00:00
dma-mapping.h
dma.h
early_ioremap.h mm/early_ioremap: add null pointer checks to prevent NULL-pointer dereference 2025-01-13 22:40:59 -08:00
emergency-restart.h
error-injection.h
exec.h
extable.h
fixmap.h fixmap: Remove unused set_fixmap_offset_io() 2024-07-11 17:41:23 +02:00
flat.h
fprobe.h fprobe: Add fprobe_header encoding feature 2024-12-26 10:50:05 -05:00
ftrace.h
futex.h
getorder.h
hardirq.h
hugetlb.h mm: consolidate common checks in hugetlb_get_unmapped_area 2024-11-06 20:11:10 -08:00
hw_irq.h
int-ll64.h
io.h New implementation for IO memcpy and IO memset 2024-10-28 21:44:29 +00:00
ioctl.h
iomap.h
irq.h
irq_regs.h
irq_work.h
irqflags.h
kdebug.h
kmap_size.h
kprobes.h
kvm_para.h
kvm_types.h
linkage.h
local.h
local64.h
logic_io.h
mcs_spinlock.h
memory_model.h asm-generic: add an optional pfn_valid check to page_to_phys 2024-10-28 21:44:28 +00:00
mm_hooks.h mm: remove arch_unmap() 2024-09-01 20:26:13 -07:00
mmiowb.h
mmiowb_types.h
mmu.h
mmu_context.h
mmzone.h arch, mm: move definition of node_data to generic code 2024-09-03 21:15:28 -07:00
module.h
module.lds.h
mshyperv.h hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h 2025-01-10 00:54:21 +00:00
msi.h
nommu_context.h
numa.h arch_numa: switch over to numa_memblks 2024-09-03 21:15:32 -07:00
param.h
parport.h
pci.h
pci_iomap.h
percpu.h
pgalloc.h mm: introduce ctor/dtor at PGD level 2025-01-25 20:22:24 -08:00
pgtable-nop4d.h
pgtable-nopmd.h mm: recover pud_leaf() definitions in nopmd case 2024-03-13 12:12:21 -07:00
pgtable-nopud.h
pgtable_uffd.h
preempt.h
qrwlock.h
qrwlock_types.h
qspinlock.h riscv: Add qspinlock support 2024-11-11 07:33:20 -08:00
qspinlock_types.h
resource.h
runtime-const.h runtime constants: add default dummy infrastructure 2024-06-19 12:34:34 -07:00
rwonce.h
seccomp.h
sections.h jump_label,module: Don't alloc static_key_mod for __ro_after_init keys 2024-03-22 11:18:16 +01:00
serial.h
set_memory.h
shmparam.h
signal.h
simd.h
softirq_stack.h
spinlock.h asm-generic: ticket-lock: Add separate ticket-lock.h 2024-11-11 07:33:17 -08:00
spinlock_types.h asm-generic: ticket-lock: Reuse arch_spinlock_t of qspinlock 2024-11-11 07:33:16 -08:00
statfs.h
string.h
switch_to.h
syscall.h include: update references to include/asm-<arch> 2025-01-12 20:20:59 -08:00
syscalls.h syscalls: mmap(): use unsigned offset type consistently 2024-06-25 15:57:38 +02:00
text-patching.h asm-generic: introduce text-patching.h 2024-11-07 14:25:15 -08:00
ticket_spinlock.h riscv: Add qspinlock support 2024-11-11 07:33:20 -08:00
timex.h
tlb.h mm: pgtable: introduce generic pagetable_dtor_free() 2025-01-25 20:22:23 -08:00
tlbflush.h
topology.h
trace_clock.h
uaccess.h move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
user.h
vermagic.h
vga.h empty include/asm-generic/vga.h 2024-11-11 21:51:42 +01:00
video.h arch: Rename fbdev header and source files 2024-05-03 17:07:50 +02:00
vmlinux.lds.h kbuild: keep symbols for symbol_get() even with CONFIG_TRIM_UNUSED_KSYMS 2025-02-06 01:08:58 +09:00
word-at-a-time.h kernel.h: removed REPEAT_BYTE from kernel.h 2024-02-01 09:47:59 -08:00
xor.h