diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-10-01 10:42:07 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-10-01 10:42:07 +0200 |
commit | 3749c3aff6512003a61b7cf4a96eff0e8926d781 (patch) | |
tree | debf17ccc76ce25d7a749cc34444172fc5b2cb9c /libgomp | |
parent | 998e434f8f9ce42842710af9e33c1b9732b22999 (diff) | |
download | gcc-3749c3aff6512003a61b7cf4a96eff0e8926d781.zip gcc-3749c3aff6512003a61b7cf4a96eff0e8926d781.tar.gz gcc-3749c3aff6512003a61b7cf4a96eff0e8926d781.tar.bz2 |
openmp: Avoid PLT relocations for omp_* symbols in libgomp
This patch avoids the following relocations:
readelf -Wr libgomp.so.1.0.0 | grep omp_
00000000000470e0 0000020700000007 R_X86_64_JUMP_SLOT 000000000001d9d0 omp_fulfill_event@@OMP_5.0.1 + 0
0000000000047170 000000b800000007 R_X86_64_JUMP_SLOT 000000000000e760 omp_display_env@@OMP_5.1 + 0
00000000000471e0 000000e800000007 R_X86_64_JUMP_SLOT 000000000000f910 omp_get_initial_device@@OMP_4.5 + 0
0000000000047280 0000019500000007 R_X86_64_JUMP_SLOT 0000000000015940 omp_get_active_level@@OMP_3.0 + 0
00000000000472c8 0000020d00000007 R_X86_64_JUMP_SLOT 0000000000035210 omp_get_team_num@@OMP_4.0 + 0
00000000000472f0 0000014700000007 R_X86_64_JUMP_SLOT 0000000000035200 omp_get_num_teams@@OMP_4.0 + 0
by using ialias{,_call,_redirect} macros as needed.
We still have many acc_* PLT relocations, could somebody please fix those?
readelf -Wr libgomp.so.1.0.0 | grep acc_
0000000000046fb8 000001ed00000006 R_X86_64_GLOB_DAT 0000000000036350 acc_prof_unregister@@OACC_2.5.1 + 0
0000000000046fd8 000000a400000006 R_X86_64_GLOB_DAT 0000000000035f30 acc_prof_register@@OACC_2.5.1 + 0
0000000000046fe0 000001d100000006 R_X86_64_GLOB_DAT 0000000000035ee0 acc_prof_lookup@@OACC_2.5.1 + 0
0000000000047058 000001dd00000007 R_X86_64_JUMP_SLOT 0000000000031f40 acc_create_async@@OACC_2.5 + 0
0000000000047068 0000011500000007 R_X86_64_JUMP_SLOT 000000000002fc60 acc_get_property@@OACC_2.6 + 0
0000000000047070 000001fb00000007 R_X86_64_JUMP_SLOT 0000000000032ce0 acc_wait_all@@OACC_2.0 + 0
0000000000047080 0000006500000007 R_X86_64_JUMP_SLOT 000000000002f990 acc_on_device@@OACC_2.0 + 0
0000000000047088 000000ae00000007 R_X86_64_JUMP_SLOT 0000000000032140 acc_attach_async@@OACC_2.6 + 0
0000000000047090 0000021900000007 R_X86_64_JUMP_SLOT 000000000002f550 acc_get_device_type@@OACC_2.0 + 0
0000000000047098 000001cb00000007 R_X86_64_JUMP_SLOT 0000000000032090 acc_copyout_finalize@@OACC_2.5 + 0
00000000000470a8 0000005200000007 R_X86_64_JUMP_SLOT 0000000000031f80 acc_copyin@@OACC_2.0 + 0
00000000000470b8 000001ad00000007 R_X86_64_JUMP_SLOT 0000000000032030 acc_delete_finalize@@OACC_2.5 + 0
00000000000470e8 0000010900000007 R_X86_64_JUMP_SLOT 0000000000031f00 acc_create@@OACC_2.0 + 0
00000000000470f8 0000005900000007 R_X86_64_JUMP_SLOT 0000000000032b70 acc_wait_async@@OACC_2.0 + 0
0000000000047110 0000013100000007 R_X86_64_JUMP_SLOT 0000000000032860 acc_async_test@@OACC_2.0 + 0
0000000000047118 000001ff00000007 R_X86_64_JUMP_SLOT 000000000002f720 acc_get_device_num@@OACC_2.0 + 0
0000000000047128 0000019100000007 R_X86_64_JUMP_SLOT 0000000000032020 acc_delete_async@@OACC_2.5 + 0
0000000000047130 000001d200000007 R_X86_64_JUMP_SLOT 000000000002efa0 acc_shutdown@@OACC_2.0 + 0
0000000000047150 000000d000000007 R_X86_64_JUMP_SLOT 0000000000031f00 acc_present_or_create@@OACC_2.0 + 0
0000000000047188 0000019200000007 R_X86_64_JUMP_SLOT 0000000000031910 acc_is_present@@OACC_2.0 + 0
0000000000047190 000001aa00000007 R_X86_64_JUMP_SLOT 000000000002fca0 acc_get_property_string@@OACC_2.6 + 0
00000000000471d0 000001bf00000007 R_X86_64_JUMP_SLOT 0000000000032120 acc_update_self_async@@OACC_2.5 + 0
0000000000047200 0000020500000007 R_X86_64_JUMP_SLOT 0000000000032e00 acc_wait_all_async@@OACC_2.0 + 0
0000000000047208 000000a600000007 R_X86_64_JUMP_SLOT 0000000000031790 acc_deviceptr@@OACC_2.0 + 0
0000000000047218 0000007500000007 R_X86_64_JUMP_SLOT 0000000000032000 acc_delete@@OACC_2.0 + 0
0000000000047238 000001e900000007 R_X86_64_JUMP_SLOT 000000000002f3a0 acc_set_device_type@@OACC_2.0 + 0
0000000000047240 000001f600000007 R_X86_64_JUMP_SLOT 000000000002ef20 acc_init@@OACC_2.0 + 0
0000000000047248 0000018800000007 R_X86_64_JUMP_SLOT 0000000000032060 acc_copyout@@OACC_2.0 + 0
0000000000047258 0000021f00000007 R_X86_64_JUMP_SLOT 0000000000032a80 acc_wait@@OACC_2.0 + 0
0000000000047270 000001bc00000007 R_X86_64_JUMP_SLOT 0000000000032100 acc_update_self@@OACC_2.0 + 0
0000000000047288 0000011400000007 R_X86_64_JUMP_SLOT 0000000000032080 acc_copyout_async@@OACC_2.5 + 0
0000000000047290 0000013d00000007 R_X86_64_JUMP_SLOT 000000000002f850 acc_set_device_num@@OACC_2.0 + 0
00000000000472a8 000000c500000007 R_X86_64_JUMP_SLOT 00000000000320e0 acc_update_device_async@@OACC_2.5 + 0
00000000000472c0 0000014600000007 R_X86_64_JUMP_SLOT 0000000000031fc0 acc_copyin_async@@OACC_2.5 + 0
00000000000472f8 0000006a00000007 R_X86_64_JUMP_SLOT 000000000002f310 acc_get_num_devices@@OACC_2.0 + 0
0000000000047350 0000021700000007 R_X86_64_JUMP_SLOT 0000000000031f80 acc_present_or_copyin@@OACC_2.0 + 0
0000000000047360 0000020900000007 R_X86_64_JUMP_SLOT 00000000000320c0 acc_update_device@@OACC_2.0 + 0
0000000000047380 0000008400000007 R_X86_64_JUMP_SLOT 0000000000032950 acc_async_test_all@@OACC_2.0 + 0
2021-10-01 Jakub Jelinek <jakub@redhat.com>
* affinity-fmt.c (omp_get_team_num, omp_get_num_teams): Add
ialias_redirect.
* env.c (handle_omp_display_env): Use ialias_call.
* icv-device.c: Move ialias right below each function.
(omp_get_device_num): Use ialias_call.
* fortran.c (omp_fulfill_event): Add ialias_redirect.
* icv.c (omp_get_active_level): Add ialias_redirect.
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/affinity-fmt.c | 3 | ||||
-rw-r--r-- | libgomp/env.c | 2 | ||||
-rw-r--r-- | libgomp/fortran.c | 1 | ||||
-rw-r--r-- | libgomp/icv-device.c | 17 | ||||
-rw-r--r-- | libgomp/icv.c | 2 |
5 files changed, 18 insertions, 7 deletions
diff --git a/libgomp/affinity-fmt.c b/libgomp/affinity-fmt.c index 9f40e37..75940b5 100644 --- a/libgomp/affinity-fmt.c +++ b/libgomp/affinity-fmt.c @@ -37,6 +37,9 @@ #include <sys/utsname.h> #endif +ialias_redirect (omp_get_team_num) +ialias_redirect (omp_get_num_teams) + bool gomp_print_string (const char *str, size_t len) { diff --git a/libgomp/env.c b/libgomp/env.c index 9216998..69ce1d2 100644 --- a/libgomp/env.c +++ b/libgomp/env.c @@ -1416,7 +1416,7 @@ handle_omp_display_env (void) gomp_error ("Invalid value for environment variable OMP_DISPLAY_ENV"); if (display) - omp_display_env (verbose); + ialias_call (omp_display_env) (verbose); } diff --git a/libgomp/fortran.c b/libgomp/fortran.c index 07f9765..d171c79 100644 --- a/libgomp/fortran.c +++ b/libgomp/fortran.c @@ -96,6 +96,7 @@ ialias_redirect (omp_destroy_allocator) ialias_redirect (omp_set_default_allocator) ialias_redirect (omp_get_default_allocator) ialias_redirect (omp_display_env) +ialias_redirect (omp_fulfill_event) #endif #ifndef LIBGOMP_GNU_SYMBOL_VERSIONING diff --git a/libgomp/icv-device.c b/libgomp/icv-device.c index f11bdfa..709ceeb 100644 --- a/libgomp/icv-device.c +++ b/libgomp/icv-device.c @@ -35,6 +35,8 @@ omp_set_default_device (int device_num) icv->default_device_var = device_num >= 0 ? device_num : 0; } +ialias (omp_set_default_device) + int omp_get_default_device (void) { @@ -42,18 +44,24 @@ omp_get_default_device (void) return icv->default_device_var; } +ialias (omp_get_default_device) + int omp_get_initial_device (void) { return gomp_get_num_devices (); } +ialias (omp_get_initial_device) + int omp_get_num_devices (void) { return gomp_get_num_devices (); } +ialias (omp_get_num_devices) + int omp_is_initial_device (void) { @@ -61,17 +69,14 @@ omp_is_initial_device (void) return 1; } +ialias (omp_is_initial_device) + int omp_get_device_num (void) { /* By specification, this is equivalent to omp_get_initial_device on the host. */ - return omp_get_initial_device (); + return ialias_call (omp_get_initial_device) (); } -ialias (omp_set_default_device) -ialias (omp_get_default_device) -ialias (omp_get_initial_device) -ialias (omp_get_num_devices) -ialias (omp_is_initial_device) ialias (omp_get_device_num) diff --git a/libgomp/icv.c b/libgomp/icv.c index e32e5b2..4b4892f 100644 --- a/libgomp/icv.c +++ b/libgomp/icv.c @@ -30,6 +30,8 @@ #include "gomp-constants.h" #include <limits.h> +ialias_redirect (omp_get_active_level) + void omp_set_num_threads (int n) { |