[lld] r336788 - Remove a workaround for an old GCC bug.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 03:52:00 PDT 2018


Author: ruiu
Date: Wed Jul 11 03:52:00 2018
New Revision: 336788

URL: http://llvm.org/viewvc/llvm-project?rev=336788&view=rev
Log:
Remove a workaround for an old GCC bug.

This workaround is for GCC 5.4.1. Without this workaround, lld will
produce larger .gdb_index sections for object files compiled with the
buggy version of the compiler.

Since it is not for correctness, and it affects only debug builds (since
you are generating .gdb_index sections), perhaps the hack shouldn't have been
added in the first place. At least, I think it is time to remove this hack.

Differential Revision: https://reviews.llvm.org/D49149

Removed:
    lld/trunk/test/ELF/gdb-index-dup-types.s
Modified:
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=336788&r1=336787&r2=336788&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed Jul 11 03:52:00 2018
@@ -2375,11 +2375,7 @@ createSymbols(ArrayRef<std::vector<GdbIn
     for (const NameTypeEntry &Ent : Entries) {
       size_t &Idx = Map[Ent.Name];
       if (Idx) {
-        // gcc 5.4.1 produces a buggy .debug_gnu_pubnames that contains
-        // duplicate entries, so we want to dedup them.
-        std::vector<uint32_t> &Vec = Ret[Idx - 1].CuVector;
-        if (Vec.empty() || Vec.back() != Ent.Type)
-          Vec.push_back(Ent.Type);
+        Ret[Idx - 1].CuVector.push_back(Ent.Type);
         continue;
       }
 

Removed: lld/trunk/test/ELF/gdb-index-dup-types.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gdb-index-dup-types.s?rev=336787&view=auto
==============================================================================
--- lld/trunk/test/ELF/gdb-index-dup-types.s (original)
+++ lld/trunk/test/ELF/gdb-index-dup-types.s (removed)
@@ -1,60 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: ld.lld --gdb-index %t.o -o %t
-# RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s
-
-## Testcase is based on output produced by gcc version 5.4.1 20160904
-## it has duplicate entries in .debug_gnu_pubtypes which seems to be
-## compiler bug. In that case it is useless to have them in .gdb_index
-## and we filter such entries out to reduce size of .gdb_index.
-
-## CHECK: Constant pool offset = {{.*}}, has 1 CU vectors:
-## CHECK-NOT: 0(0x0): 0x90000000 0x90000000
-
-.section .debug_abbrev,"", at progbits
- .byte 1                       # Abbreviation Code
- .byte 17                      # DW_TAG_compile_unit
- .byte 0                       # DW_CHILDREN_no
- .byte 16                      # DW_AT_stmt_list
- .byte 23                      # DW_FORM_sec_offset
- .ascii "\260B"                # DW_AT_GNU_dwo_name
- .byte 14                      # DW_FORM_strp
- .byte 27                      # DW_AT_comp_dir
- .byte 14                      # DW_FORM_strp
- .ascii "\264B"                # DW_AT_GNU_pubnames
- .byte 25                      # DW_FORM_flag_present
- .ascii "\261B"                # DW_AT_GNU_dwo_id
- .byte 7                       # DW_FORM_data8
- .ascii "\263B"                # DW_AT_GNU_addr_base
- .byte 23                      # DW_FORM_sec_offset
- .byte 0                       # EOM(1)
- .byte 0                       # EOM(2)
- .byte 0                       # EOM(3)
-
-.section .debug_info,"", at progbits
-.Lcu_begin0:
- .long 32                       # Length of Unit
- .short 4                       # DWARF version number
- .long .debug_abbrev            # Offset Into Abbrev. Section
- .byte 8                        # Address Size (in bytes)
- .byte 1                        # Abbrev [1] 0xb:0x19 DW_TAG_compile_unit
- .long 0                        # DW_AT_stmt_list
- .long 0                        # DW_AT_GNU_dwo_name
- .long 0                        # DW_AT_comp_dir
- .quad 0                        # DW_AT_GNU_dwo_id
- .long 0                        # DW_AT_GNU_addr_base
-
-.section .debug_gnu_pubtypes,"", at progbits
-.long .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info
-.LpubTypes_begin0:
- .short 2                      # DWARF Version
- .long .Lcu_begin0             # Offset of Compilation Unit Info
- .long 36                      # Compilation Unit Length
- .long 36                      # DIE offset
- .byte 144                     # Kind: TYPE, STATIC
- .asciz "int"                  # External Name
- .long 36                      # DIE offset
- .byte 144                     # Kind: TYPE, STATIC
- .asciz "int"                  # External Name
- .long 0                       # End Mark
-.LpubTypes_end0:




More information about the llvm-commits mailing list