Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * When building position independent code with GCC using the -fPIC option, |
| 4 | * (or even the -fPIE one on older versions), it will assume that we are |
| 5 | * building a dynamic object (either a shared library or an executable) that |
| 6 | * may have symbol references that can only be resolved at load time. For a |
| 7 | * variety of reasons (ELF symbol preemption, the CoW footprint of the section |
| 8 | * that is modified by the loader), this results in all references to symbols |
| 9 | * with external linkage to go via entries in the Global Offset Table (GOT), |
| 10 | * which carries absolute addresses which need to be fixed up when the |
| 11 | * executable image is loaded at an offset which is different from its link |
| 12 | * time offset. |
| 13 | * |
| 14 | * Fortunately, there is a way to inform the compiler that such symbol |
| 15 | * references will be satisfied at link time rather than at load time, by |
| 16 | * giving them 'hidden' visibility. |
| 17 | */ |
| 18 | |
| 19 | #pragma GCC visibility push(hidden) |