This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, I discovered a bug with ICF. This is a reduced test-case of the problem. I could not write a program to reproduce this so I had to write assembly. Here, I show two functions that are not identical but claimed so by ICF. $ objdump -dr icf_bug_reduced.o | less 0000000000000000 <_Z3barv>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: b8 00 00 00 00 mov $0x0,%eax 9: b8 00 00 00 00 mov $0x0,%eax a: R_X86_64_32 a e: c9 leaveq f: c3 retq Disassembly of section .text._Z3bazv: 0000000000000000 <_Z3bazv>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: b8 00 00 00 00 mov $0x0,%eax 5: R_X86_64_32 a 9: b8 00 00 00 00 mov $0x0,%eax e: c9 leaveq f: c3 retq bar and baz are not identical. But, their text is the same and their relocs are in the same order which agrees with the ICF matching algorithm. The current ICF algorithm does not use the off-set of the reloc. The reasoning was if the off-sets are different then the text must be too. This test-case violates it. I have added the reloc offset information to the matching. Here is the patch. Please let me know what you think ? 2010-02-19 Sriraman Tallam <tmsriram@google.com> * gc.h (gc_process_relocs): Change vectors to point to the new list. Add reloc offset information. * icf.cc (get_section_contents): Change iterators to point to the new vectors. Add reloc offset information to the contents. * icf.h (Icf::Sections_reachable_info): New typedef. (Icf::Sections_reachable_list): New typedef. (Icf::Offset_info): New typedef. (Icf::Reloc_info): New struct typedef. (Icf::Reloc_info_list): New typedef. (Icf::symbol_reloc_list): Delete method. (Icf::addend_reloc_list): Delete method. (Icf::section_reloc_list): Delete method. (Icf::reloc_info_list): New method. (Icf::reloc_info_list_): New member. Thanks, -Sriraman.
Attachment:
gold_icf_bug_patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |