https://sourceware.org/bugzilla/show_bug.cgi?id=24302
Bug ID: 24302 Summary: When DF_BIND_NOW the dt_tlsdesc_got should not be used Product: binutils Version: 2.31 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: wangtao42 at huawei dot com Target Milestone: --- Hi All, I produced a problem, and after debugging it seems that in elfNN_aarch64_finish_dynamic_sections the value of htab->dt_tlsdesc_got should be checked. If the htab->dt_tlsdesc_got is -1, then htab->root.sgot->contents should not add it, otherwise this code will overwrite the contents of the previous byte. The maybe-error code is as follows: if (htab->tlsdesc_plt) { bfd_put_NN (output_bfd, (bfd_vma) 0, htab->root.sgot->contents + htab->dt_tlsdesc_got); memcpy (htab->root.splt->contents + htab->tlsdesc_plt, elfNN_aarch64_tlsdesc_small_plt_entry, sizeof (elfNN_aarch64_tlsdesc_small_plt_entry)); This is aarch64 backend, and the only assignment of dt_tlsdesc_got is limited by DF_BIND_NOW. when linking with "-z now", this code won't be executed /* If we're not using lazy TLS relocations, don't generate the GOT entry required. */ if (!(info->flags & DF_BIND_NOW)) { htab->dt_tlsdesc_got = htab->root.sgot->size; htab->root.sgot->size += GOT_ENTRY_SIZE; } So anyone can explain this? Is htab->dt_tlsdesc_got needed to check validaty before using in elfNN_aarch64_finish_dynamic_sections? Because it needs many object file to reproduce this problem, I can't upload a testcase. I'll be very grateful if someone can explain the code. Thanks -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils