1 | /** @file
|
---|
2 | * IPRT - Linux symver and compatibility definitions.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2008-2023 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | /* Various tricks to produce binaries which can be run on old Linux
|
---|
37 | * distributions. This will almost certainly need updating as time
|
---|
38 | * goes by. */
|
---|
39 |
|
---|
40 | #ifndef IPRT_INCLUDED_linux_symvers_h
|
---|
41 | #define IPRT_INCLUDED_linux_symvers_h
|
---|
42 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
43 | # pragma once
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | /* Please use -fno-stack-protector on the command line to avoid stack check
|
---|
47 | * functions which are not available in EL3 for 32-bit builds. */
|
---|
48 |
|
---|
49 | /* Use versions of glibc symbols which are available in 32-bit EL3 or
|
---|
50 | * 64-bit EL4. Currently only those symbols needed by the Additions,
|
---|
51 | * though this could probably be extended to work for host builds too. */
|
---|
52 | #if defined(RT_ARCH_AMD64)
|
---|
53 | __asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
|
---|
54 | __asm__(".symver posix_spawn,posix_spawn@GLIBC_2.2.5");
|
---|
55 | #elif defined(RT_ARCH_ARM64)
|
---|
56 | __asm__(".symver memcpy,memcpy@GLIBC_2.17");
|
---|
57 | __asm__(".symver posix_spawn,posix_spawn@GLIBC_2.17");
|
---|
58 | #else /* RT_ARCH_X86 */
|
---|
59 | __asm__(".symver posix_spawn,posix_spawn@GLIBC_2.2");
|
---|
60 | #endif
|
---|
61 |
|
---|
62 | /* Do not use *_chk functions */
|
---|
63 | #undef _FORTIFY_SOURCE
|
---|
64 |
|
---|
65 | /* Do not use __isoc99_* functions */
|
---|
66 | #undef __USE_GNU
|
---|
67 | #define __USE_GNU 1
|
---|
68 |
|
---|
69 | /* And EL5 wants this too with __USE_GNU */
|
---|
70 | #undef _GNU_SOURCE
|
---|
71 | #define _GNU_SOURCE 1
|
---|
72 |
|
---|
73 | /* Tell IPRT not to use newer functions */
|
---|
74 | #include <features.h>
|
---|
75 | #undef __GLIBC_MINOR__
|
---|
76 | #define __GLIBC_MINOR__ 3
|
---|
77 |
|
---|
78 | /* Do not use fcntl64 */
|
---|
79 | #include <fcntl.h>
|
---|
80 | #ifdef fnctl
|
---|
81 | # undef fcntl
|
---|
82 | #endif
|
---|
83 | #if defined(RT_ARCH_AMD64)
|
---|
84 | __asm__(".symver fcntl64,fcntl@GLIBC_2.2.5");
|
---|
85 | #elif defined(RT_ARCH_ARM64)
|
---|
86 | __asm__(".symver fcntl64,fcntl@GLIBC_2.17");
|
---|
87 | #else
|
---|
88 | __asm__(".symver fcntl64,fcntl@GLIBC_2.0");
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | /* Do not use ISO C99 scanf which has a glibc 2.7 dependency. */
|
---|
92 | #undef __GLIBC_USE_DEPRECATED_SCANF
|
---|
93 | #define __GLIBC_USE_DEPRECATED_SCANF 1
|
---|
94 | #endif /* !IPRT_INCLUDED_linux_symvers_h */
|
---|