Add ifunc support for statically linked applications on x86, ppc, sparc and ARM.diff -r1.243 -r1.244 src/distrib/sets/lists/debug/mi
(joerg)
--- src/distrib/sets/lists/debug/mi 2018/02/17 08:07:06 1.243
+++ src/distrib/sets/lists/debug/mi 2018/03/09 20:20:48 1.244
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: mi,v 1.243 2018/02/17 08:07:06 wiz Exp $ | 1 | # $NetBSD: mi,v 1.244 2018/03/09 20:20:48 joerg Exp $ | |
2 | ./etc/mtree/set.debug comp-sys-root | 2 | ./etc/mtree/set.debug comp-sys-root | |
3 | ./usr/lib comp-sys-usr compatdir | 3 | ./usr/lib comp-sys-usr compatdir | |
4 | ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile | 4 | ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile | |
5 | ./usr/lib/i18n/libDECHanyu_g.a comp-c-debuglib debuglib,compatfile | 5 | ./usr/lib/i18n/libDECHanyu_g.a comp-c-debuglib debuglib,compatfile | |
6 | ./usr/lib/i18n/libEUCTW_g.a comp-c-debuglib debuglib,compatfile | 6 | ./usr/lib/i18n/libEUCTW_g.a comp-c-debuglib debuglib,compatfile | |
7 | ./usr/lib/i18n/libEUC_g.a comp-c-debuglib debuglib,compatfile | 7 | ./usr/lib/i18n/libEUC_g.a comp-c-debuglib debuglib,compatfile | |
8 | ./usr/lib/i18n/libGBK2K_g.a comp-c-debuglib debuglib,compatfile | 8 | ./usr/lib/i18n/libGBK2K_g.a comp-c-debuglib debuglib,compatfile | |
9 | ./usr/lib/i18n/libHZ_g.a comp-c-debuglib debuglib,compatfile | 9 | ./usr/lib/i18n/libHZ_g.a comp-c-debuglib debuglib,compatfile | |
10 | ./usr/lib/i18n/libISO2022_g.a comp-c-debuglib debuglib,compatfile | 10 | ./usr/lib/i18n/libISO2022_g.a comp-c-debuglib debuglib,compatfile | |
11 | ./usr/lib/i18n/libJOHAB_g.a comp-c-debuglib debuglib,compatfile | 11 | ./usr/lib/i18n/libJOHAB_g.a comp-c-debuglib debuglib,compatfile | |
12 | ./usr/lib/i18n/libMSKanji_g.a comp-c-debuglib debuglib,compatfile | 12 | ./usr/lib/i18n/libMSKanji_g.a comp-c-debuglib debuglib,compatfile | |
13 | ./usr/lib/i18n/libUES_g.a comp-c-debuglib debuglib,compatfile | 13 | ./usr/lib/i18n/libUES_g.a comp-c-debuglib debuglib,compatfile | |
14 | ./usr/lib/i18n/libUTF1632_g.a comp-c-debuglib debuglib,compatfile | 14 | ./usr/lib/i18n/libUTF1632_g.a comp-c-debuglib debuglib,compatfile | |
@@ -1855,26 +1855,27 @@ | @@ -1855,26 +1855,27 @@ | |||
1855 | ./usr/libdata/debug/usr/tests/kyua-testers/atf_list_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1855 | ./usr/libdata/debug/usr/tests/kyua-testers/atf_list_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1856 | ./usr/libdata/debug/usr/tests/kyua-testers/atf_result_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1856 | ./usr/libdata/debug/usr/tests/kyua-testers/atf_result_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1857 | ./usr/libdata/debug/usr/tests/kyua-testers/cli_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1857 | ./usr/libdata/debug/usr/tests/kyua-testers/cli_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1858 | ./usr/libdata/debug/usr/tests/kyua-testers/env_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1858 | ./usr/libdata/debug/usr/tests/kyua-testers/env_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1859 | ./usr/libdata/debug/usr/tests/kyua-testers/error_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1859 | ./usr/libdata/debug/usr/tests/kyua-testers/error_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1860 | ./usr/libdata/debug/usr/tests/kyua-testers/fs_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1860 | ./usr/libdata/debug/usr/tests/kyua-testers/fs_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1861 | ./usr/libdata/debug/usr/tests/kyua-testers/plain_helpers.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1861 | ./usr/libdata/debug/usr/tests/kyua-testers/plain_helpers.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1862 | ./usr/libdata/debug/usr/tests/kyua-testers/plain_inttest.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1862 | ./usr/libdata/debug/usr/tests/kyua-testers/plain_inttest.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1863 | ./usr/libdata/debug/usr/tests/kyua-testers/result_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1863 | ./usr/libdata/debug/usr/tests/kyua-testers/result_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1864 | ./usr/libdata/debug/usr/tests/kyua-testers/run_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1864 | ./usr/libdata/debug/usr/tests/kyua-testers/run_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1865 | ./usr/libdata/debug/usr/tests/kyua-testers/stacktrace_helper.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1865 | ./usr/libdata/debug/usr/tests/kyua-testers/stacktrace_helper.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1866 | ./usr/libdata/debug/usr/tests/kyua-testers/stacktrace_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1866 | ./usr/libdata/debug/usr/tests/kyua-testers/stacktrace_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1867 | ./usr/libdata/debug/usr/tests/kyua-testers/text_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | 1867 | ./usr/libdata/debug/usr/tests/kyua-testers/text_test.debug tests-kyua-tests debug,atf,kyua,compattestfile | |
1868 | ./usr/libdata/debug/usr/tests/lib/csu/h_ifunc_static.debug tests-lib-debug debug,atf,compattestfile | |||
1868 | ./usr/libdata/debug/usr/tests/lib/csu/h_initfini.debug tests-obsolete obsolete,compattestfile | 1869 | ./usr/libdata/debug/usr/tests/lib/csu/h_initfini.debug tests-obsolete obsolete,compattestfile | |
1869 | ./usr/libdata/debug/usr/tests/lib/csu/h_initfini1.debug tests-lib-debug debug,atf,compattestfile | 1870 | ./usr/libdata/debug/usr/tests/lib/csu/h_initfini1.debug tests-lib-debug debug,atf,compattestfile | |
1870 | ./usr/libdata/debug/usr/tests/lib/csu/h_initfini2.debug tests-lib-debug debug,atf,compattestfile | 1871 | ./usr/libdata/debug/usr/tests/lib/csu/h_initfini2.debug tests-lib-debug debug,atf,compattestfile | |
1871 | ./usr/libdata/debug/usr/tests/lib/csu/h_initfini3.debug tests-lib-debug debug,atf,compattestfile | 1872 | ./usr/libdata/debug/usr/tests/lib/csu/h_initfini3.debug tests-lib-debug debug,atf,compattestfile | |
1872 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_bluetooth.debug tests-lib-debug debug,atf,compattestfile | 1873 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_bluetooth.debug tests-lib-debug debug,atf,compattestfile | |
1873 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_data.debug tests-lib-debug debug,atf,compattestfile | 1874 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_data.debug tests-lib-debug debug,atf,compattestfile | |
1874 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_get.debug tests-lib-debug debug,atf,compattestfile | 1875 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_get.debug tests-lib-debug debug,atf,compattestfile | |
1875 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_match.debug tests-lib-debug debug,atf,compattestfile | 1876 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_match.debug tests-lib-debug debug,atf,compattestfile | |
1876 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_put.debug tests-lib-debug debug,atf,compattestfile | 1877 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_put.debug tests-lib-debug debug,atf,compattestfile | |
1877 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_set.debug tests-lib-debug debug,atf,compattestfile | 1878 | ./usr/libdata/debug/usr/tests/lib/libbluetooth/t_sdp_set.debug tests-lib-debug debug,atf,compattestfile | |
1878 | ./usr/libdata/debug/usr/tests/lib/libbpfjit/t_bpfjit.debug tests-lib-debug debug,atf,sljit,compattestfile | 1879 | ./usr/libdata/debug/usr/tests/lib/libbpfjit/t_bpfjit.debug tests-lib-debug debug,atf,sljit,compattestfile | |
1879 | ./usr/libdata/debug/usr/tests/lib/libbpfjit/t_cop.debug tests-lib-debug debug,atf,sljit,compattestfile | 1880 | ./usr/libdata/debug/usr/tests/lib/libbpfjit/t_cop.debug tests-lib-debug debug,atf,sljit,compattestfile | |
1880 | ./usr/libdata/debug/usr/tests/lib/libbpfjit/t_extmem.debug tests-lib-debug debug,atf,sljit,compattestfile | 1881 | ./usr/libdata/debug/usr/tests/lib/libbpfjit/t_extmem.debug tests-lib-debug debug,atf,sljit,compattestfile |
--- src/distrib/sets/lists/tests/mi 2018/02/22 14:24:03 1.775
+++ src/distrib/sets/lists/tests/mi 2018/03/09 20:20:48 1.776
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: mi,v 1.775 2018/02/22 14:24:03 martin Exp $ | 1 | # $NetBSD: mi,v 1.776 2018/03/09 20:20:48 joerg Exp $ | |
2 | # | 2 | # | |
3 | # Note: don't delete entries from here - mark them as "obsolete" instead. | 3 | # Note: don't delete entries from here - mark them as "obsolete" instead. | |
4 | # | 4 | # | |
5 | ./etc/mtree/set.tests tests-sys-root | 5 | ./etc/mtree/set.tests tests-sys-root | |
6 | ./usr/libdata/debug/usr/tests tests-base-debug compattestdir | 6 | ./usr/libdata/debug/usr/tests tests-base-debug compattestdir | |
7 | ./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf | 7 | ./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf | |
8 | ./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf | 8 | ./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf | |
9 | ./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf | 9 | ./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf | |
10 | ./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf | 10 | ./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf | |
11 | ./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf | 11 | ./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf | |
12 | ./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete | 12 | ./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete | |
13 | ./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete | 13 | ./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete | |
14 | ./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete | 14 | ./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete | |
@@ -2389,31 +2389,33 @@ | @@ -2389,31 +2389,33 @@ | |||
2389 | ./usr/tests/kyua-testers/plain_helpers tests-kyua-tests compattestfile,atf,kyua | 2389 | ./usr/tests/kyua-testers/plain_helpers tests-kyua-tests compattestfile,atf,kyua | |
2390 | ./usr/tests/kyua-testers/plain_inttest tests-kyua-tests compattestfile,atf,kyua | 2390 | ./usr/tests/kyua-testers/plain_inttest tests-kyua-tests compattestfile,atf,kyua | |
2391 | ./usr/tests/kyua-testers/result_test tests-kyua-tests compattestfile,atf,kyua | 2391 | ./usr/tests/kyua-testers/result_test tests-kyua-tests compattestfile,atf,kyua | |
2392 | ./usr/tests/kyua-testers/run_test tests-kyua-tests compattestfile,atf,kyua | 2392 | ./usr/tests/kyua-testers/run_test tests-kyua-tests compattestfile,atf,kyua | |
2393 | ./usr/tests/kyua-testers/stacktrace_helper tests-kyua-tests compattestfile,atf,kyua | 2393 | ./usr/tests/kyua-testers/stacktrace_helper tests-kyua-tests compattestfile,atf,kyua | |
2394 | ./usr/tests/kyua-testers/stacktrace_test tests-kyua-tests compattestfile,atf,kyua | 2394 | ./usr/tests/kyua-testers/stacktrace_test tests-kyua-tests compattestfile,atf,kyua | |
2395 | ./usr/tests/kyua-testers/text_test tests-kyua-tests compattestfile,atf,kyua | 2395 | ./usr/tests/kyua-testers/text_test tests-kyua-tests compattestfile,atf,kyua | |
2396 | ./usr/tests/lib tests-lib-tests compattestfile,atf | 2396 | ./usr/tests/lib tests-lib-tests compattestfile,atf | |
2397 | ./usr/tests/lib/Atffile tests-lib-tests compattestfile,atf | 2397 | ./usr/tests/lib/Atffile tests-lib-tests compattestfile,atf | |
2398 | ./usr/tests/lib/Kyuafile tests-lib-tests compattestfile,atf,kyua | 2398 | ./usr/tests/lib/Kyuafile tests-lib-tests compattestfile,atf,kyua | |
2399 | ./usr/tests/lib/csu tests-lib-tests compattestfile,atf | 2399 | ./usr/tests/lib/csu tests-lib-tests compattestfile,atf | |
2400 | ./usr/tests/lib/csu/Atffile tests-lib-tests compattestfile,atf | 2400 | ./usr/tests/lib/csu/Atffile tests-lib-tests compattestfile,atf | |
2401 | ./usr/tests/lib/csu/Kyuafile tests-lib-tests compattestfile,atf,kyua | 2401 | ./usr/tests/lib/csu/Kyuafile tests-lib-tests compattestfile,atf,kyua | |
2402 | ./usr/tests/lib/csu/h_ifunc_static tests-lib-tests compattestfile,atf | |||
2402 | ./usr/tests/lib/csu/h_initfini tests-obsolete obsolete | 2403 | ./usr/tests/lib/csu/h_initfini tests-obsolete obsolete | |
2403 | ./usr/tests/lib/csu/h_initfini1 tests-lib-tests compattestfile,atf | 2404 | ./usr/tests/lib/csu/h_initfini1 tests-lib-tests compattestfile,atf | |
2404 | ./usr/tests/lib/csu/h_initfini2 tests-lib-tests compattestfile,atf | 2405 | ./usr/tests/lib/csu/h_initfini2 tests-lib-tests compattestfile,atf | |
2405 | ./usr/tests/lib/csu/h_initfini3 tests-lib-tests compattestfile,atf | 2406 | ./usr/tests/lib/csu/h_initfini3 tests-lib-tests compattestfile,atf | |
2406 | ./usr/tests/lib/csu/t_crt0 tests-lib-tests compattestfile,atf | 2407 | ./usr/tests/lib/csu/t_crt0 tests-lib-tests compattestfile,atf | |
2408 | ./usr/tests/lib/csu/t_ifunc_static tests-lib-tests compattestfile,atf | |||
2407 | ./usr/tests/lib/libbluetooth tests-lib-tests compattestfile,atf | 2409 | ./usr/tests/lib/libbluetooth tests-lib-tests compattestfile,atf | |
2408 | ./usr/tests/lib/libbluetooth/Atffile tests-lib-tests compattestfile,atf | 2410 | ./usr/tests/lib/libbluetooth/Atffile tests-lib-tests compattestfile,atf | |
2409 | ./usr/tests/lib/libbluetooth/Kyuafile tests-lib-tests compattestfile,atf,kyua | 2411 | ./usr/tests/lib/libbluetooth/Kyuafile tests-lib-tests compattestfile,atf,kyua | |
2410 | ./usr/tests/lib/libbluetooth/t_bluetooth tests-lib-tests compattestfile,atf | 2412 | ./usr/tests/lib/libbluetooth/t_bluetooth tests-lib-tests compattestfile,atf | |
2411 | ./usr/tests/lib/libbluetooth/t_sdp_data tests-lib-tests compattestfile,atf | 2413 | ./usr/tests/lib/libbluetooth/t_sdp_data tests-lib-tests compattestfile,atf | |
2412 | ./usr/tests/lib/libbluetooth/t_sdp_get tests-lib-tests compattestfile,atf | 2414 | ./usr/tests/lib/libbluetooth/t_sdp_get tests-lib-tests compattestfile,atf | |
2413 | ./usr/tests/lib/libbluetooth/t_sdp_match tests-lib-tests compattestfile,atf | 2415 | ./usr/tests/lib/libbluetooth/t_sdp_match tests-lib-tests compattestfile,atf | |
2414 | ./usr/tests/lib/libbluetooth/t_sdp_put tests-lib-tests compattestfile,atf | 2416 | ./usr/tests/lib/libbluetooth/t_sdp_put tests-lib-tests compattestfile,atf | |
2415 | ./usr/tests/lib/libbluetooth/t_sdp_set tests-lib-tests compattestfile,atf | 2417 | ./usr/tests/lib/libbluetooth/t_sdp_set tests-lib-tests compattestfile,atf | |
2416 | ./usr/tests/lib/libbpfjit tests-lib-tests compattestfile,atf | 2418 | ./usr/tests/lib/libbpfjit tests-lib-tests compattestfile,atf | |
2417 | ./usr/tests/lib/libbpfjit/Atffile tests-lib-tests compattestfile,atf,sljit | 2419 | ./usr/tests/lib/libbpfjit/Atffile tests-lib-tests compattestfile,atf,sljit | |
2418 | ./usr/tests/lib/libbpfjit/Kyuafile tests-lib-tests compattestfile,atf,sljit,kyua | 2420 | ./usr/tests/lib/libbpfjit/Kyuafile tests-lib-tests compattestfile,atf,sljit,kyua | |
2419 | ./usr/tests/lib/libbpfjit/t_bpfjit tests-lib-tests compattestfile,atf,sljit | 2421 | ./usr/tests/lib/libbpfjit/t_bpfjit tests-lib-tests compattestfile,atf,sljit |
--- src/lib/csu/common/crt0-common.c 2016/06/07 12:07:35 1.14
+++ src/lib/csu/common/crt0-common.c 2018/03/09 20:20:47 1.15
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: crt0-common.c,v 1.14 2016/06/07 12:07:35 joerg Exp $ */ | 1 | /* $NetBSD: crt0-common.c,v 1.15 2018/03/09 20:20:47 joerg Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1998 Christos Zoulas | 4 | * Copyright (c) 1998 Christos Zoulas | |
5 | * Copyright (c) 1995 Christopher G. Demetriou | 5 | * Copyright (c) 1995 Christopher G. Demetriou | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -26,27 +26,27 @@ | @@ -26,27 +26,27 @@ | |||
26 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 26 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
27 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 27 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
29 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 29 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
34 | * | 34 | * | |
35 | * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> | 35 | * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> | |
36 | */ | 36 | */ | |
37 | 37 | |||
38 | #include <sys/cdefs.h> | 38 | #include <sys/cdefs.h> | |
39 | __RCSID("$NetBSD: crt0-common.c,v 1.14 2016/06/07 12:07:35 joerg Exp $"); | 39 | __RCSID("$NetBSD: crt0-common.c,v 1.15 2018/03/09 20:20:47 joerg Exp $"); | |
40 | 40 | |||
41 | #include <sys/types.h> | 41 | #include <sys/types.h> | |
42 | #include <sys/exec.h> | 42 | #include <sys/exec.h> | |
43 | #include <sys/syscall.h> | 43 | #include <sys/syscall.h> | |
44 | #include <machine/profile.h> | 44 | #include <machine/profile.h> | |
45 | #include <stdlib.h> | 45 | #include <stdlib.h> | |
46 | #include <unistd.h> | 46 | #include <unistd.h> | |
47 | 47 | |||
48 | #include "rtld.h" | 48 | #include "rtld.h" | |
49 | 49 | |||
50 | extern int main(int, char **, char **); | 50 | extern int main(int, char **, char **); | |
51 | 51 | |||
52 | #ifndef HAVE_INITFINI_ARRAY | 52 | #ifndef HAVE_INITFINI_ARRAY | |
@@ -117,26 +117,94 @@ _init(void) | @@ -117,26 +117,94 @@ _init(void) | |||
117 | (*f)(); | 117 | (*f)(); | |
118 | } | 118 | } | |
119 | } | 119 | } | |
120 | 120 | |||
121 | static void | 121 | static void | |
122 | _fini(void) | 122 | _fini(void) | |
123 | { | 123 | { | |
124 | for (const fptr_t *f = __fini_array_start; f < __fini_array_end; f++) { | 124 | for (const fptr_t *f = __fini_array_start; f < __fini_array_end; f++) { | |
125 | (*f)(); | 125 | (*f)(); | |
126 | } | 126 | } | |
127 | } | 127 | } | |
128 | #endif /* HAVE_INITFINI_ARRAY */ | 128 | #endif /* HAVE_INITFINI_ARRAY */ | |
129 | 129 | |||
130 | #if defined(__x86_64__) || defined(__powerpc__) || defined(__sparc__) | |||
131 | #define HAS_IPLTA | |||
132 | static void fix_iplta(void) __noinline; | |||
133 | #elif defined(__i386__) || defined(__arm__) | |||
134 | #define HAS_IPLT | |||
135 | static void fix_iplt(void) __noinline; | |||
136 | #endif | |||
137 | ||||
138 | ||||
139 | #ifdef HAS_IPLTA | |||
140 | #include <stdio.h> | |||
141 | extern const Elf_Rela __rela_iplt_start[] __dso_hidden __weak; | |||
142 | extern const Elf_Rela __rela_iplt_end[] __dso_hidden __weak; | |||
143 | ||||
144 | static void | |||
145 | fix_iplta(void) | |||
146 | { | |||
147 | const Elf_Rela *rela, *relalim; | |||
148 | uintptr_t relocbase = 0; | |||
149 | Elf_Addr *where, target; | |||
150 | ||||
151 | rela = __rela_iplt_start; | |||
152 | relalim = __rela_iplt_end; | |||
153 | #if DEBUG | |||
154 | printf("%p - %p\n", rela, relalim); | |||
155 | #endif | |||
156 | for (; rela < relalim; ++rela) { | |||
157 | if (ELF_R_TYPE(rela->r_info) != R_TYPE(IRELATIVE)) | |||
158 | abort(); | |||
159 | where = (Elf_Addr *)(relocbase + rela->r_offset); | |||
160 | #if DEBUG | |||
161 | printf("location: %p\n", where); | |||
162 | #endif | |||
163 | target = (Elf_Addr)(relocbase + rela->r_addend); | |||
164 | #if DEBUG | |||
165 | printf("target: %p\n", (void *)target); | |||
166 | #endif | |||
167 | target = ((Elf_Addr(*)(void))target)(); | |||
168 | #if DEBUG | |||
169 | printf("...resolves to: %p\n", (void *)target); | |||
170 | #endif | |||
171 | *where = target; | |||
172 | } | |||
173 | } | |||
174 | #endif | |||
175 | #ifdef HAS_IPLT | |||
176 | extern const Elf_Rel __rel_iplt_start[] __dso_hidden __weak; | |||
177 | extern const Elf_Rel __rel_iplt_end[] __dso_hidden __weak; | |||
178 | ||||
179 | static void | |||
180 | fix_iplt(void) | |||
181 | { | |||
182 | const Elf_Rel *rel, *rellim; | |||
183 | uintptr_t relocbase = 0; | |||
184 | Elf_Addr *where, target; | |||
185 | ||||
186 | rel = __rel_iplt_start; | |||
187 | rellim = __rel_iplt_end; | |||
188 | for (; rel < rellim; ++rel) { | |||
189 | if (ELF_R_TYPE(rel->r_info) != R_TYPE(IRELATIVE)) | |||
190 | abort(); | |||
191 | where = (Elf_Addr *)(relocbase + rel->r_offset); | |||
192 | target = ((Elf_Addr(*)(void))*where)(); | |||
193 | *where = target; | |||
194 | } | |||
195 | } | |||
196 | #endif | |||
197 | ||||
130 | void | 198 | void | |
131 | ___start(void (*cleanup)(void), /* from shared loader */ | 199 | ___start(void (*cleanup)(void), /* from shared loader */ | |
132 | const Obj_Entry *obj, /* from shared loader */ | 200 | const Obj_Entry *obj, /* from shared loader */ | |
133 | struct ps_strings *ps_strings) | 201 | struct ps_strings *ps_strings) | |
134 | { | 202 | { | |
135 | 203 | |||
136 | if (ps_strings == NULL) | 204 | if (ps_strings == NULL) | |
137 | _FATAL("ps_strings missing\n"); | 205 | _FATAL("ps_strings missing\n"); | |
138 | __ps_strings = ps_strings; | 206 | __ps_strings = ps_strings; | |
139 | 207 | |||
140 | environ = ps_strings->ps_envstr; | 208 | environ = ps_strings->ps_envstr; | |
141 | 209 | |||
142 | if (ps_strings->ps_argvstr[0] != NULL) { | 210 | if (ps_strings->ps_argvstr[0] != NULL) { | |
@@ -152,26 +220,35 @@ ___start(void (*cleanup)(void), /* fro | @@ -152,26 +220,35 @@ ___start(void (*cleanup)(void), /* fro | |||
152 | 220 | |||
153 | if (&rtld_DYNAMIC != NULL) { | 221 | if (&rtld_DYNAMIC != NULL) { | |
154 | if (obj == NULL) | 222 | if (obj == NULL) | |
155 | _FATAL("NULL Obj_Entry pointer in GOT\n"); | 223 | _FATAL("NULL Obj_Entry pointer in GOT\n"); | |
156 | if (obj->magic != RTLD_MAGIC) | 224 | if (obj->magic != RTLD_MAGIC) | |
157 | _FATAL("Corrupt Obj_Entry pointer in GOT\n"); | 225 | _FATAL("Corrupt Obj_Entry pointer in GOT\n"); | |
158 | if (obj->version != RTLD_VERSION) | 226 | if (obj->version != RTLD_VERSION) | |
159 | _FATAL("Dynamic linker version mismatch\n"); | 227 | _FATAL("Dynamic linker version mismatch\n"); | |
160 | atexit(cleanup); | 228 | atexit(cleanup); | |
161 | } | 229 | } | |
162 | 230 | |||
163 | _libc_init(); | 231 | _libc_init(); | |
164 | 232 | |||
233 | if (&rtld_DYNAMIC == NULL) { | |||
234 | #ifdef HAS_IPLTA | |||
235 | fix_iplta(); | |||
236 | #endif | |||
237 | #ifdef HAS_IPLT | |||
238 | fix_iplt(); | |||
239 | #endif | |||
240 | } | |||
241 | ||||
165 | #ifdef HAVE_INITFINI_ARRAY | 242 | #ifdef HAVE_INITFINI_ARRAY | |
166 | _preinit(); | 243 | _preinit(); | |
167 | #endif | 244 | #endif | |
168 | 245 | |||
169 | #ifdef MCRT0 | 246 | #ifdef MCRT0 | |
170 | atexit(_mcleanup); | 247 | atexit(_mcleanup); | |
171 | monstartup((u_long)&__eprol, (u_long)&__etext); | 248 | monstartup((u_long)&__eprol, (u_long)&__etext); | |
172 | #endif | 249 | #endif | |
173 | 250 | |||
174 | atexit(_fini); | 251 | atexit(_fini); | |
175 | _init(); | 252 | _init(); | |
176 | 253 | |||
177 | exit(main(ps_strings->ps_nargvstr, ps_strings->ps_argvstr, environ)); | 254 | exit(main(ps_strings->ps_nargvstr, ps_strings->ps_argvstr, environ)); |
--- src/tests/lib/csu/Makefile 2016/04/04 09:52:02 1.5
+++ src/tests/lib/csu/Makefile 2018/03/09 20:20:47 1.6
@@ -1,27 +1,31 @@ | @@ -1,27 +1,31 @@ | |||
1 | # $NetBSD: Makefile,v 1.5 2016/04/04 09:52:02 joerg Exp $ | 1 | # $NetBSD: Makefile,v 1.6 2018/03/09 20:20:47 joerg Exp $ | |
2 | 2 | |||
3 | NOMAN= # defined | 3 | NOMAN= # defined | |
4 | 4 | |||
5 | .include <bsd.own.mk> | 5 | .include <bsd.own.mk> | |
6 | 6 | |||
7 | TESTSDIR= ${TESTSBASE}/lib/csu | 7 | TESTSDIR= ${TESTSBASE}/lib/csu | |
8 | TESTS_SH= t_crt0 | 8 | TESTS_SH= t_crt0 t_ifunc_static | |
9 | TESTS_SUBDIRS= | 9 | TESTS_SUBDIRS= | |
10 | SUBDIR+= dso | 10 | SUBDIR+= dso | |
11 | 11 | |||
12 | .include "Makefile.check_stack" | 12 | .include "Makefile.check_stack" | |
13 | 13 | |||
14 | CPPFLAGS+= ${CPPFLAGS_CHECK_STACK} | 14 | CPPFLAGS+= ${CPPFLAGS_CHECK_STACK} | |
15 | 15 | |||
16 | BINDIR= ${TESTSDIR} | 16 | BINDIR= ${TESTSDIR} | |
17 | PROG_CXX= h_initfini1 h_initfini2 h_initfini3 | 17 | PROG_CXX= h_initfini1 h_initfini2 h_initfini3 | |
18 | SRCS.h_initfini1= h_initfini1.cxx h_initfini_common.cxx \ | 18 | SRCS.h_initfini1= h_initfini1.cxx h_initfini_common.cxx \ | |
19 | ${SRCS_CHECK_STACK} | 19 | ${SRCS_CHECK_STACK} | |
20 | SRCS.h_initfini2= h_initfini1.cxx h_initfini_common.cxx \ | 20 | SRCS.h_initfini2= h_initfini1.cxx h_initfini_common.cxx \ | |
21 | ${SRCS_CHECK_STACK} | 21 | ${SRCS_CHECK_STACK} | |
22 | LDSTATIC.h_initfini2+= -static | 22 | LDSTATIC.h_initfini2+= -static | |
23 | SRCS.h_initfini3= h_initfini3.cxx h_initfini_common.cxx \ | 23 | SRCS.h_initfini3= h_initfini3.cxx h_initfini_common.cxx \ | |
24 | ${SRCS_CHECK_STACK} | 24 | ${SRCS_CHECK_STACK} | |
25 | LDADD.h_initfini3+= -Wl,-rpath,${TESTSDIR} | 25 | LDADD.h_initfini3+= -Wl,-rpath,${TESTSDIR} | |
26 | 26 | |||
27 | PROGS+= h_ifunc_static | |||
28 | SRCS.h_ifunc_static= h_ifunc_static.c | |||
29 | LDSTATIC.h_ifunc_static=-static | |||
30 | ||||
27 | .include <bsd.test.mk> | 31 | .include <bsd.test.mk> |
/* $NetBSD: h_ifunc_static.c,v 1.1 2018/03/09 20:20:47 joerg Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Joerg Sonnenberger.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include <string.h>
static long long
ifunc1(void)
{
return 0xdeadbeefll;
}
static long long
ifunc2(void)
{
return 0xbeefdeadll;
}
static __attribute__((used))
long long (*resolve_ifunc(void))(void)
{
const char *e = getenv("USE_IFUNC2");
return e && strcmp(e, "1") == 0 ? ifunc2 : ifunc1;
}
__ifunc(ifunc, resolve_ifunc);
extern long long ifunc(void);
int
main(int argc, char **argv)
{
if (argc != 2)
return 1;
return atoll(argv[1]) != ifunc();
}
# $NetBSD: t_ifunc_static.sh,v 1.1 2018/03/09 20:20:47 joerg Exp $
#
# Copyright (c) 2018 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
atf_test_case ifunc_static
ifunc_static_head()
{
atf_set "descr" "Checks support for ifunc relocations in static binaries"
}
ifunc_static_body()
{
case `uname -m` in
i386|amd64|*ppc*|*sparc*|*arm*)
;;
*)
atf_skip "ifunc is supposed only on ARM, i386, PowerPC, SPARC and x86-64"
;;
esac
USE_IFUNC2=0 "$(atf_get_srcdir)/h_ifunc_static" 3735928559
atf_check_equal $? 0
USE_IFUNC2=0 "$(atf_get_srcdir)/h_ifunc_static" 3203391149
atf_check_equal $? 1
USE_IFUNC2=1 "$(atf_get_srcdir)/h_ifunc_static" 3735928559
atf_check_equal $? 1
USE_IFUNC2=1 "$(atf_get_srcdir)/h_ifunc_static" 3203391149
atf_check_equal $? 0
}
atf_init_test_cases()
{
atf_add_test_case ifunc_static
}