https://sourceware.org/bugzilla/show_bug.cgi?id=26103
--- Comment #7 from Markus Böck <markus.boeck02 at gmail dot com> --- This sadly was more complicated than I thought as WSL 1 doesn't support watchpoints but docker did the job. I set the watchpoint on h->type for the weak symbol and it only gets set to bfd_link_hash_undefined once at linker.c:1483 and is then never written to again. My gdb console: Breakpoint 2, _bfd_generic_link_add_one_symbol (info=0x5629c5a7c820 <link_info>, abfd=0x5629c82a7800, name=0x5629c83adf64 ".weak._ZSt4swapISt6localeENSt9enable_ifIXsrSt6__and_IISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SF_._ZStanSt12_Ios_IostateS_", flags=2, section=0x5629c5a71108 <_bfd_std_section+296>, value=0, string=0x0, copy=0, collect=0, hashp=0x5629c8376250) at ../../bfd/linker.c:1449 1449 if (info->notice_all (gdb) watch -l h->type Hardware watchpoint 3: -location h->type Hardware watchpoint 3: -location h->type Old value = bfd_link_hash_new New value = bfd_link_hash_undefined _bfd_generic_link_add_one_symbol (info=0x5629c5a7c820 <link_info>, abfd=0x5629c82a7800, name=0x5629c83adf64 ".weak._ZSt4swapISt6localeENSt9enable_ifIXsrSt6__and_IISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SF_._ZStanSt12_Ios_IostateS_", flags=2, section=0x5629c5a71108 <_bfd_std_section+296>, value=0, string=0x0, copy=0, collect=0, hashp=0x5629c8376250) at ../../bfd/linker.c:1484 1484 h->u.undef.abfd = abfd; [Detaching after vfork from child process 435] Breakpoint 1, ldlang_add_file (entry=0x5629c73595e0) at ../../ld/ldlang.c:7269 7269 ASSERT (entry->the_bfd->link.next == NULL); To make sure that I was using watchpoints right (my first time) I used awatch instead and it showed up every read in the program. Observed the same read and writes when not using LTO. Both times with -O0 -- You are receiving this mail because: You are on the CC list for the bug.