PowerPC TPREL_HA/LO optimisation
Gleb Fotengauer-Malinovskiy
glebfm@altlinux.org
Thu Nov 12 17:26:53 GMT 2020
Hi,
On Mon, Aug 24, 2020 at 09:43:08PM +0930, Alan Modra via Binutils wrote:
> ppc64 ld optimises sequences like the following
> addis 3,13,wot@tprel@ha
> lwz 3,wot@tprel@l(3)
> to
> nop
> lwz 3,wot@tprel(13)
> when "wot" is located near enough to the thread pointer.
> However, the ABI doesn't require that R_PPC64_TPREL16_HA always be on
> an addis rt,13,imm instruction, and while ld checked for that on the
> high-part instruction it didn't disable the optimisation on the
> low-part instruction. This patch fixes that problem, disabling the
> tprel optimisation globally if high-part instructions don't pass
> sanity checks. The optimisation is also enabled for ppc32, where
> before ld.bfd had the code in the wrong place and ld.gold had it in a
> block only enabled for ppc64.
Looks like this commit broke incremental_test.sh test in gold on ppc64le.
(I added abort(); to the end of do_gold_unreachable function to get this
backtrace.)
$ gdb -q --args ./gold/incremental-dump gold/testsuite/incremental_test
Reading symbols from ./gold/incremental-dump...
(gdb) run
Starting program: /usr/src/binutils-gdb/build/gold/incremental-dump gold/testsuite/incremental_test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
(null): internal error in options, at ../../gold/parameters.h:92
Program received signal SIGABRT, Aborted.
0x00007ffff7908f04 in __libc_signal_restore_set (set=0x7fffffffea98) at ../sysdeps/unix/sysv/linux/internal-signals.h:104
104 INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
(gdb) bt
#0 0x00007ffff7908f04 in __libc_signal_restore_set (set=0x7fffffffea98) at ../sysdeps/unix/sysv/linux/internal-signals.h:104
#1 __GI_raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:47
#2 0x00007ffff78e9868 in __GI_abort () at abort.c:79
#3 0x000000001028f2d4 in gold::do_gold_unreachable (filename=0x104add08 "../../gold/parameters.h", lineno=<optimized out>, function=0x104add00 "options")
at ../../gold/gold.cc:102
#4 0x00000000100793dc in gold::Parameters::options (this=<optimized out>) at ../../gold/parameters.h:92
#5 0x00000000100a2b98 in gold::Parameters::options (this=<optimized out>) at ../../gold/powerpc.cc:12736
#6 (anonymous namespace)::Target_powerpc<64, false>::Target_powerpc (this=0x105f3f80) at ../../gold/powerpc.cc:653
#7 (anonymous namespace)::Target_selector_powerpc<64, false>::do_instantiate_target (this=<optimized out>) at ../../gold/powerpc.cc:644
#8 0x000000001043af70 in gold::Target_selector::set_target (this=0x105d0ed0 <(anonymous namespace)::target_selector_ppc64le>)
at ../../gold/target-select.cc:83
#9 gold::Set_target_once::do_run_once (this=<optimized out>) at ../../gold/target-select.cc:50
#10 0x0000000010292df8 in gold::Once::internal_run (arg=0x0, this=0x105d0f08 <(anonymous namespace)::target_selector_ppc64le+56>)
at ../../gold/gold-threads.cc:421
#11 gold::c_run_once () at ../../gold/gold-threads.cc:328
#12 0x00007ffff7af5890 in __pthread_once_slow (once_control=0x105f1fd0, init_routine=0x10292d60 <gold::c_run_once()>) at pthread_once.c:116
#13 0x00000000102928ac in gold::Once::run_once (this=0x105d0f08 <(anonymous namespace)::target_selector_ppc64le+56>, arg=0x0)
at ../../gold/gold-threads.cc:294
#14 0x000000001043b1f0 in gold::Target_selector::instantiate_target (this=0x105d0ed0 <(anonymous namespace)::target_selector_ppc64le>)
at ../../gold/target-select.cc:73
#15 gold::Target_selector::do_recognize (this=0x105d0ed0 <(anonymous namespace)::target_selector_ppc64le>) at ../../gold/target-select.h:166
#16 gold::Target_selector::recognize (abiversion=<optimized out>, osabi=<optimized out>, machine=<optimized out>, offset=<optimized out>,
input_file=<optimized out>, this=0x105d0ed0 <(anonymous namespace)::target_selector_ppc64le>) at ../../gold/target-select.h:82
#17 gold::select_target (input_file=0x0, offset=0, machine=<optimized out>, size=<optimized out>, is_big_endian=<optimized out>, osabi=<optimized out>,
abiversion=<optimized out>) at ../../gold/target-select.cc:112
#18 0x000000001029b980 in gold::(anonymous namespace)::make_sized_incremental_binary<64, false> (ehdr=..., file=0x105f3f50) at ../../gold/incremental.cc:854
#19 gold::open_incremental_binary (file=0x105f3f50) at ../../gold/incremental.cc:943
#20 0x000000001000d3e8 in main (argc=<optimized out>, argv=0x7ffffffff4f8) at ../../gold/incremental-dump.cc:474
--
glebfm
More information about the Binutils
mailing list