[Bug gas/27228] New: mips: gas produces strange section on gcc LTO outputs
https://sourceware.org/bugzilla/show_bug.cgi?id=27228 Bug ID: 27228 Summary: mips: gas produces strange section on gcc LTO outputs Product: binutils Version: 2.35.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: xry111 at mengyan1223 dot wang Target Milestone: --- We've discussed this in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97787 and Richard suggests to report it as a gas bug. $ cat t.s .text foo: .reloc 1f,R_MIPS_JALR,.LTHUNK5.lto_priv.0 1: nop $ mips64el-unknown-linux-gnuabi64-as -64 t.s $ mips64el-unknown-linux-gnuabi64-readelf -s a.out Symbol table '.symtab' contains 10 entries: Num:Value Size TypeBind Vis Ndx Name 0: 0 NOTYPE LOCAL DEFAULT UND 1: 0 SECTION LOCAL DEFAULT1 2: 0 SECTION LOCAL DEFAULT3 3: 0 SECTION LOCAL DEFAULT4 4: 0 NOTYPE LOCAL DEFAULT1 foo 5: 0 SECTION LOCAL DEFAULT5 6: 0 SECTION LOCAL DEFAULT6 7: 0 SECTION LOCAL DEFAULT7 8: 0 SECTION LOCAL DEFAULT8 9: 0 SECTION LOCAL DEFAULT UND $ mips64el-unknown-linux-gnuabi64-objdump -t a.out a.out: file format elf64-tradlittlemips SYMBOL TABLE: ld .text .text ld .data .data ld .bss .bss l .text foo ld .MIPS.options .MIPS.options ld .MIPS.abiflags .MIPS.abiflags ld .pdr .pdr ld .gnu.attributes .gnu.attributes ld *UND* The last "unnamed section" does not make any sense to us. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gas/27228] mips: gas produces strange section on gcc LTO outputs
https://sourceware.org/bugzilla/show_bug.cgi?id=27228 Xi Ruoyao changed: What|Removed |Added CC||rguenth at gcc dot gnu.org, ||xry111 at mengyan1223 dot wang -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27229] New: Writing symbols section - example code does not work
https://sourceware.org/bugzilla/show_bug.cgi?id=27229 Bug ID: 27229 Summary: Writing symbols section - example code does not work Product: binutils Version: 2.35.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: karthik.eu at outlook dot com Target Milestone: --- Created attachment 13149 --> https://sourceware.org/bugzilla/attachment.cgi?id=13149&action=edit object file I am following the example at https://sourceware.org/binutils/docs-2.35/bfd/Writing-Symbols.html#Writing-Symbols My code is slightly modified and I expect it to produce a pe-x86-64 COFF object file. ``` bfd_init(); auto *abfd = bfd_openw("test.obj", "pe-x86-64"); my_assert(bfd_set_format(abfd, bfd_object)); my_assert(bfd_set_file_flags(abfd, HAS_RELOC | HAS_SYMS)); auto symbol = bfd_make_empty_symbol(abfd); symbol->name = "my_data"; symbol->section = bfd_make_section_old_way(abfd, ".data"); symbol->flags = BSF_GLOBAL; symbol->value = 0xab; asymbol *symbols[] = { symbol, nullptr }; bfd_set_symtab(abfd, symbols, 1); bfd_close(abfd); ``` Both `nm` and `objdump` from the same mingw64 environment do not recognize this file. > C:\msys64\mingw64\bin\nm.exe: test.obj: file format not recognized On the other hand, `dumpbin` utility on windows can read it > Dump of file test.obj > File Type: COFF OBJECT > Summary > 0 .data When I use `pei-x86-64` instead of `pe-x86-64`, the file utility reads my file > test.obj: PE Unknown PE signature 0x0 (stripped to external PDB), for MS > Windows I tried to read the same with ``` bfd *abfd = bfd_openr(test_bin, nullptr); bool isCorrectFormat = bfd_check_format(abfd, bfd_object); ``` and this also failed with `bfd_get_error() -> bfd_error_file_not_recognized`. What I am doing wrong? Did I misunderstand the target names? I am trying to generate an object file with some data in the `.data` section and I want mingw-w64-x86_64-binutils tools to recognize this file. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27229] Writing symbols section - example code does not work
https://sourceware.org/bugzilla/show_bug.cgi?id=27229 karthik.eu at outlook dot com changed: What|Removed |Added Target||x86_64-w64-mingw32 Host||x86_64-w64-mingw32 -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/27230] New: ld: Add DWARF v5 sections and .debug_types to ld/scripttempl/DWARF.sc
https://sourceware.org/bugzilla/show_bug.cgi?id=27230 Bug ID: 27230 Summary: ld: Add DWARF v5 sections and .debug_types to ld/scripttempl/DWARF.sc Product: binutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: i at maskray dot me Target Milestone: --- Let me try this:) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/27230] ld: Add DWARF v5 sections and .debug_types to ld/scripttempl/DWARF.sc
https://sourceware.org/bugzilla/show_bug.cgi?id=27230 --- Comment #1 from Fangrui Song --- Patch: https://sourceware.org/pipermail/binutils/2021-January/115064.html -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] New: objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 Bug ID: 27231 Summary: objdump -S doesn't work on DWARF5 generated by GCC 11 Product: binutils Version: 2.36 Status: NEW Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com CC: nickc at redhat dot com Target Milestone: --- Created attachment 13150 --> https://sourceware.org/bugzilla/attachment.cgi?id=13150&action=edit Testcase objdump -S doesn't display source on gcc-11.o. It works fine on gcc-10.o -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 H.J. Lu changed: What|Removed |Added CC||mark at klomp dot org Assignee|unassigned at sourceware dot org |hjl.tools at gmail dot com Target Milestone|--- |2.36 --- Comment #1 from H.J. Lu --- A patch is posted at https://sourceware.org/pipermail/binutils/2021-January/115065.html -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gas/27228] .reloc wrong symbol emitted for undefined local symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=27228 Alan Modra changed: What|Removed |Added Assignee|unassigned at sourceware dot org |amodra at gmail dot com Ever confirmed|0 |1 Summary|mips: gas produces strange |.reloc wrong symbol emitted |section on gcc LTO outputs |for undefined local symbol Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2021-01-24 -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 --- Comment #2 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=18454c151f5824564130ba626bd90e9de30444ef commit 18454c151f5824564130ba626bd90e9de30444ef Author: H.J. Lu Date: Sat Jan 23 18:17:37 2021 -0800 DWARF-5: Fix parsing DWARF-5 line number tables Advance rngs_ptr when parsing DW_RLE_offset_pair, which was missing in commit c3757b583d2448a5996e83e374fb96ac7938da35 Author: Mark Wielaard Date: Tue Aug 25 15:33:00 2020 +0100 Fix the linker's handling of DWARF-5 line number tables. PR binutils/27231 * dwarf2.c (read_rnglists): Advance rngs_ptr after _bfd_safe_read_leb128 when parsing DW_RLE_offset_pair. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 --- Comment #3 from cvs-commit at gcc dot gnu.org --- The binutils-2_36-branch branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=74c1e3df55c9e418e231a1ef36ff706688a3088b commit 74c1e3df55c9e418e231a1ef36ff706688a3088b Author: H.J. Lu Date: Sat Jan 23 18:17:37 2021 -0800 DWARF-5: Fix parsing DWARF-5 line number tables Advance rngs_ptr when parsing DW_RLE_offset_pair, which was missing in commit c3757b583d2448a5996e83e374fb96ac7938da35 Author: Mark Wielaard Date: Tue Aug 25 15:33:00 2020 +0100 Fix the linker's handling of DWARF-5 line number tables. PR binutils/27231 * dwarf2.c (read_rnglists): Advance rngs_ptr after _bfd_safe_read_leb128 when parsing DW_RLE_offset_pair. (cherry picked from commit 18454c151f5824564130ba626bd90e9de30444ef) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 --- Comment #4 from cvs-commit at gcc dot gnu.org --- The binutils-2_35-branch branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0da7136ac1a83080996247551286019066fbd0e3 commit 0da7136ac1a83080996247551286019066fbd0e3 Author: H.J. Lu Date: Sat Jan 23 18:17:37 2021 -0800 DWARF-5: Fix parsing DWARF-5 line number tables Advance rngs_ptr when parsing DW_RLE_offset_pair, which was missing in commit c3757b583d2448a5996e83e374fb96ac7938da35 Author: Mark Wielaard Date: Tue Aug 25 15:33:00 2020 +0100 Fix the linker's handling of DWARF-5 line number tables. PR binutils/27231 * dwarf2.c (read_rnglists): Advance rngs_ptr after _bfd_safe_read_leb128 when parsing DW_RLE_offset_pair. (cherry picked from commit 18454c151f5824564130ba626bd90e9de30444ef) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 H.J. Lu changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from H.J. Lu --- Fixed for 2.36 and binutils-2_35-branch. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 H.J. Lu changed: What|Removed |Added CC||jakub at redhat dot com --- Comment #6 from H.J. Lu --- GCC 11 also generates: 0176 2097 (base address) 017f 2097 20f8 0182 213d 213d (start == end) 0187 233f 2346 018c .LLRL171: .byte 0x5 .quad .LBB2156 .byte 0x4 .uleb128 .LBB2156-.LBB2156 .uleb128 .LBE2156-.LBB2156 .byte 0x4 .uleb128 .LBB2157-.LBB2156 .uleb128 .LBE2157-.LBB2156 .byte 0x4 .uleb128 .LBB2158-.LBB2156 .uleb128 .LBE2158-.LBB2156 .byte 0 This triggers: if ((low_pc == 0 && high_pc == 0) || low_pc == high_pc) return FALSE; in read_rnglists(). Is this a GCC 11 bug? -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 --- Comment #7 from H.J. Lu --- There are .LLRL174: .byte 0x5 .quad .LBB2159 .byte 0x4 .uleb128 .LBB2159-.LBB2159 .uleb128 .LBE2159-.LBB2159 .byte 0x4 .uleb128 .LBB2163-.LBB2159 .uleb128 .LBE2163-.LBB2159 .byte 0x4 .uleb128 .LBB2174-.LBB2159 .uleb128 .LBE2174-.LBB2159 .byte 0 for .LBB2163: .LBB2161: .loc 1 7563 17 is_stmt 1 view .LVU1621 .loc 1 7573 3 view .LVU1622 .loc 1 7573 3 is_stmt 0 view .LVU1623 .LBE2161: .LBE2163: .loc 1 7787 3 is_stmt 1 view .LVU1624 .LBB2164: .loc 1 7789 5 view .LVU1625 .loc 1 7790 5 view .LVU1626 .loc 1 7790 21 is_stmt 0 view .LVU1627 movq-312(%rbp), %rax movq-336(%rbp), %r15 .LBB2165: .LBB2163 and .LBE2163 have the same address. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/27231] objdump -S doesn't work on DWARF5 generated by GCC 11
https://sourceware.org/bugzilla/show_bug.cgi?id=27231 H.J. Lu changed: What|Removed |Added Resolution|FIXED |--- Status|RESOLVED|REOPENED --- Comment #8 from H.J. Lu --- In gcc.o, GCC 11 generates 139: 0524 3750 3750 (start == end) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gas/27228] .reloc wrong symbol emitted for undefined local symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=27228 --- Comment #1 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Alan Modra : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=68fcee4fa753f6488c9f90610da2f5a5a95d5a1f commit 68fcee4fa753f6488c9f90610da2f5a5a95d5a1f Author: Alan Modra Date: Sun Jan 24 12:39:07 2021 +1030 PR27228, .reloc wrong symbol emitted for undefined local symbol Local symbols are of course supposed to be defined by their object file, but in other cases a local symbol is promoted to global by gas if undefined and referenced. This patch stops gas wrongly replacing a local undefined symbol with the undefined section symbol, resulting in a .reloc undefined local symbol being emitted as global. PR 27228 * write.c (resolve_reloc_expr_symbols): Don't assume local symbol is defined. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gas/27228] .reloc wrong symbol emitted for undefined local symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=27228 --- Comment #2 from cvs-commit at gcc dot gnu.org --- The binutils-2_36-branch branch has been updated by Alan Modra : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1aaad1d55d784670f112954fdecbd0261bfdffd7 commit 1aaad1d55d784670f112954fdecbd0261bfdffd7 Author: Alan Modra Date: Sun Jan 24 12:39:07 2021 +1030 PR27228, .reloc wrong symbol emitted for undefined local symbol Local symbols are of course supposed to be defined by their object file, but in other cases a local symbol is promoted to global by gas if undefined and referenced. This patch stops gas wrongly replacing a local undefined symbol with the undefined section symbol, resulting in a .reloc undefined local symbol being emitted as global. PR 27228 * write.c (resolve_reloc_expr_symbols): Don't assume local symbol is defined. (cherry picked from commit 68fcee4fa753f6488c9f90610da2f5a5a95d5a1f) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gas/27228] .reloc wrong symbol emitted for undefined local symbol
https://sourceware.org/bugzilla/show_bug.cgi?id=27228 Alan Modra changed: What|Removed |Added Target Milestone|--- |2.36 Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #3 from Alan Modra --- Fixed for 2.36. -- You are receiving this mail because: You are on the CC list for the bug.