xref: /kernel/linux/linux-5.10/include/linux/hidden.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * When building position independent code with GCC using the -fPIC option,
48c2ecf20Sopenharmony_ci * (or even the -fPIE one on older versions), it will assume that we are
58c2ecf20Sopenharmony_ci * building a dynamic object (either a shared library or an executable) that
68c2ecf20Sopenharmony_ci * may have symbol references that can only be resolved at load time. For a
78c2ecf20Sopenharmony_ci * variety of reasons (ELF symbol preemption, the CoW footprint of the section
88c2ecf20Sopenharmony_ci * that is modified by the loader), this results in all references to symbols
98c2ecf20Sopenharmony_ci * with external linkage to go via entries in the Global Offset Table (GOT),
108c2ecf20Sopenharmony_ci * which carries absolute addresses which need to be fixed up when the
118c2ecf20Sopenharmony_ci * executable image is loaded at an offset which is different from its link
128c2ecf20Sopenharmony_ci * time offset.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * Fortunately, there is a way to inform the compiler that such symbol
158c2ecf20Sopenharmony_ci * references will be satisfied at link time rather than at load time, by
168c2ecf20Sopenharmony_ci * giving them 'hidden' visibility.
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#pragma GCC visibility push(hidden)
20