[Bug ld/25494] [MIPS] default output as r6 when default target as r6

2021-02-28 Thread syq at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25494

--- Comment #3 from YunQiang Su  ---
(In reply to Maciej W. Rozycki from comment #2)
> For linking in raw binary chunks of data the best approach is to use GAS
> and its .incbin pseudo-op, e.g.:
> 
> $ cat xx.s
>   .incbin xx.dat
> $ mipsisa32r6el-linux-gnu-as -o xx.o xx.s
> 
> because even if we decide to make the default ABI configurable `ld -r -b
> binary' won't be able to set all the various ABI flags a given build may
> require.
> 
> As to making the default ABI/ISA configurable I would recommend reusing
> the approach we have taken with GCC, that is to provide `--with-abi=',
> `--with-arch=', `--with-arch-32=' and `--with-arch-64=' configuration
> options.  This way the toolchain will remain consistent and will not
> depend on the target triplet in a different way across packages, and also
> we won't have to invent more and more complicated target triplets to
> handle new cases as they arise.  As I recall this design decision has
> been discussed a few times over the years.
> 
> Please note that GAS/LD are low-level tools however and in ordinary use
> cases they are supposed to be driven by GCC, which will set correct flags
> according to its configuration and any additional options requested.  I'm
> not therefore sure we need to change the semantics in the first place.
> What is your use case that requires GAS/LD to be invoked directly rather
> than via GCC?
> 
> Cf. PR 25136.

Yes. It is right. While, we meet some problem in other software, for example
gnome glib, which use the `ld' to produce object from data in its Makefile.

If the result is MIPS I, and then, ld will refused to link it with other normal
object files.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25136] mips64: set abi as N64 when the ABI section triple is gnuabi64

2021-02-28 Thread syq at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=25136

--- Comment #5 from YunQiang Su  ---
(In reply to Maciej W. Rozycki from comment #4)
> As to making the default ABI/ISA configurable I would recommend reusing
> the approach we have taken with GCC, that is to provide `--with-abi=',
> `--with-arch=', `--with-arch-32=' and `--with-arch-64=' configuration
> options.  This way the toolchain will remain consistent and will not
> depend on the target triplet in a different way across packages, and also
> we won't have to invent more and more complicated target triplets to
> handle new cases as they arise.  As I recall this design decision has
> been discussed a few times over the years.
> 
> Please note that GAS/LD are low-level tools however and in ordinary use
> cases they are supposed to be driven by GCC, which will set correct flags
> according to its configuration and any additional options requested.  I'm
> not therefore sure we need to change the semantics in the first place.
> What is your use case that requires GAS/LD to be invoked directly rather
> than via GCC?
> 
> Cf. PR ld/25494.

Yes. the correct way to invoke as/ld is by gcc, while in the real Linux
distributions world, just like Debian, there are so many software invoke as/ld
directly.

To compatiable with them, we have to make our toolchain in the way as they
expect.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/27484] New: clang++: objdump: DWARF error: could not find variable specification at offset

2021-02-28 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=27484

Bug ID: 27484
   Summary: clang++: objdump: DWARF error: could not find variable
specification at offset
   Product: binutils
   Version: 2.37 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: mliska at suse dot cz
  Target Milestone: ---

The following happens when using clang compiler:

$ clang++ --version
clang version 11.0.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$ cat clang-dwarf.ii
class YearDatatypeValidator {
  static int classYearDatatypeValidator;
};
int YearDatatypeValidator::classYearDatatypeValidator;
void YearDatatypeValidatorserialize() {}

$ clang++ clang-dwarf.ii -g -c && objdump -S clang-dwarf.o

clang-dwarf.o: file format elf64-x86-64


Disassembly of section .text:

 <_Z30YearDatatypeValidatorserializev>:
objdump: DWARF error: could not find variable specification at offset 46
class YearDatatypeValidator {
  static int classYearDatatypeValidator;
};
int YearDatatypeValidator::classYearDatatypeValidator;
void YearDatatypeValidatorserialize() {}
   0:   55  push   %rbp
   1:   48 89 e5mov%rsp,%rbp
   4:   5d  pop%rbp
   5:   c3  ret

There's the content of debug info:

$ readelf --debug-dump clang-dwarf.o
Contents of the .debug_abbrev section:

  Number TAG (0x0)
   1  DW_TAG_compile_unit[has children]
DW_AT_producer DW_FORM_strp
DW_AT_language DW_FORM_data2
DW_AT_name DW_FORM_strp
DW_AT_stmt_listDW_FORM_sec_offset
DW_AT_comp_dir DW_FORM_strp
DW_AT_low_pc   DW_FORM_addr
DW_AT_high_pc  DW_FORM_data4
DW_AT value: 0 DW_FORM value: 0
   2  DW_TAG_variable[no children]
DW_AT_specification DW_FORM_ref4
DW_AT_location DW_FORM_exprloc
DW_AT_linkage_name DW_FORM_strp
DW_AT value: 0 DW_FORM value: 0
   3  DW_TAG_class_type[has children]
DW_AT_calling_convention DW_FORM_data1
DW_AT_name DW_FORM_strp
DW_AT_byte_sizeDW_FORM_data1
DW_AT_decl_fileDW_FORM_data1
DW_AT_decl_lineDW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
   4  DW_TAG_member[no children]
DW_AT_name DW_FORM_strp
DW_AT_type DW_FORM_ref4
DW_AT_decl_fileDW_FORM_data1
DW_AT_decl_lineDW_FORM_data1
DW_AT_external DW_FORM_flag_present
DW_AT_declaration  DW_FORM_flag_present
DW_AT value: 0 DW_FORM value: 0
   5  DW_TAG_base_type[no children]
DW_AT_name DW_FORM_strp
DW_AT_encoding DW_FORM_data1
DW_AT_byte_sizeDW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
   6  DW_TAG_subprogram[no children]
DW_AT_low_pc   DW_FORM_addr
DW_AT_high_pc  DW_FORM_data4
DW_AT_frame_base   DW_FORM_exprloc
DW_AT_linkage_name DW_FORM_strp
DW_AT_name DW_FORM_strp
DW_AT_decl_fileDW_FORM_data1
DW_AT_decl_lineDW_FORM_data1
DW_AT_external DW_FORM_flag_present
DW_AT value: 0 DW_FORM value: 0

Contents of the .debug_info section:

  Compilation Unit @ offset 0x0:
   Length:0x6f (32-bit)
   Version:   4
   Abbrev Offset: 0x0
   Pointer Size:  8
 <0>: Abbrev Number: 1 (DW_TAG_compile_unit)
   DW_AT_producer: (indirect string, offset: 0x0): clang version
11.0.1
<10>   DW_AT_language: 33   (C++14)
<12>   DW_AT_name: (indirect string, offset: 0x15): clang-dwarf.ii
<16>   DW_AT_stmt_list   : 0x0
<1a>   DW_AT_comp_dir: (indirect string, offset: 0x24):
/home/marxin/Programming/testcases
<1e>   DW_AT_low_pc  : 0x0
<26>   DW_AT_high_pc : 0x6
 <1><2a>: Abbrev Number: 2 (DW_TAG_variable)
<2b>   DW_AT_specification: <0x46>
<2f>   DW_AT_location: 9 byte block: 3 0 0 0 0 0 0 0 0  (DW_OP_addr: 0)
<39>   DW_AT_linkage_name: (indirect string, offset: 0x7c):
_ZN21YearDatatypeValidator26classYearDatatypeValidatorE
 <1><3d>: Abbrev Number: 3 (DW_TAG_class_type)
<3e>   DW_AT_calling_convention: 5  (pass by value)
<3f>   DW_AT_name: (indirect string, offset: 0x66):
YearDatatypeValidator
<43>   DW_AT_byte_size   : 1
<44>   DW_AT_decl_file   : 1
<45>   DW_AT_decl_line   : 1
 <2><46>: Abbrev Number: 4 (DW_TAG_member)
<47>   DW_AT_name: (indirect string, offset: 0x47):
classYearDatatypeValidator
<4b>   DW_AT_type: <0x52>
<4f>   DW_AT_decl_file   : 1
<50>   DW_AT_decl_line   : 2
<51>   DW_AT_external: 1
<51>   DW_AT_declaration : 1
 <2><51>: Abbrev Number: 0
 <1><52>: Abbrev Number: 5 (DW_TAG_base_type)
<53>   DW_AT_name: (indirect string, offset: 0x62): int
<57>   DW_AT_encoding: 5(signed

[Bug binutils/27484] clang++: objdump: DWARF error: could not find variable specification at offset

2021-02-28 Thread mliska at suse dot cz
https://sourceware.org/bugzilla/show_bug.cgi?id=27484

Martin Liska  changed:

   What|Removed |Added

 CC||mjw at fedoraproject dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/26766] Support standalone PGO build

2021-02-28 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=26766

--- Comment #26 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=1dbde357be3ce2641595b10436822e699abe32a0

commit 1dbde357be3ce2641595b10436822e699abe32a0
Author: H.J. Lu 
Date:   Sun Feb 28 04:39:38 2021 -0800

Add missing changes to Makefile.tpl

Update Makefile.tpl to add missing changes in

commit af019bfde9b13d628202fe58054ec7ff08d92a0f
Author: H.J. Lu 
Date:   Sat Jan 9 06:51:15 2021 -0800

Support the PGO build for binutils+gdb

"autogen Makefile.def" showed no changes in Makefile.in.

PR binutils/26766
* Makefile.tpl (PGO_BUILD_TRAINING_FLAGS_TO_PASS): Add
PGO_BUILD_TRAINING=yes.
(PGO_BUILD_TRAINING_MFLAGS): New.
(all): Pass $(PGO_BUILD_TRAINING_MFLAGS) to the PGO build.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/27486] New: readelf: Warning: could not find separate debug file 'libc-2.32.so.debug'

2021-02-28 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=27486

Bug ID: 27486
   Summary: readelf: Warning: could not find separate debug file
'libc-2.32.so.debug'
   Product: binutils
   Version: 2.37 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

[hjl@gnu-cfl-2 cpu-rt-c]$ readelf  --dyn-syms /lib64/libc-2.32.so| grep strchr
  1846: 000903c070 IFUNC   GLOBAL DEFAULT   16 strchr@@GLIBC_2.2.5
readelf: Warning: could not find separate debug file 'libc-2.32.so.debug'
readelf: Warning: tried: /lib/debug/libc-2.32.so.debug
readelf: Warning: tried: /usr/lib/debug/usr/libc-2.32.so.debug
readelf: Warning: tried: /usr/lib/debug//usr/lib64//libc-2.32.so.debug
readelf: Warning: tried: /usr/lib/debug/libc-2.32.so.debug
readelf: Warning: tried: /usr/lib64/.debug/libc-2.32.so.debug
readelf: Warning: tried: /usr/lib64/libc-2.32.so.debug
readelf: Warning: tried: .debug/libc-2.32.so.debug
readelf: Warning: tried: libc-2.32.so.debug
readelf: Warning: tried: DEBUGINFOD_URLS=
[hjl@gnu-cfl-2 cpu-rt-c]$ 

I only want to displace dynamic symbols.  Why should readelf care the
separate debug file?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/27484] clang++: objdump: DWARF error: could not find variable specification at offset

2021-02-28 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27484

Mark Wielaard  changed:

   What|Removed |Added

 CC||mark at klomp dot org

--- Comment #1 from Mark Wielaard  ---
Note the DW_TAG_variable DIE DW_AT_specification attribute refers to a
DW_TAG_member DIE that comes later in the CU. g++ would place those in the
opposite order, so you don't only have to look backwards in the CU.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/27484] clang++: objdump: DWARF error: could not find variable specification at offset

2021-02-28 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27484

Mark Wielaard  changed:

   What|Removed |Added

 CC|mjw at fedoraproject dot org   |

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/27478] [readelf] warning about missing section in separate debug info file

2021-02-28 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=27478

Mark Wielaard  changed:

   What|Removed |Added

 CC||mark at klomp dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/27486] readelf: Warning: could not find separate debug file 'libc-2.32.so.debug'

2021-02-28 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=27486

H.J. Lu  changed:

   What|Removed |Added

 CC||nickc at redhat dot com
   Target Milestone|--- |2.37

--- Comment #1 from H.J. Lu  ---
It is caused by

commit c46b706620eb9b27fa06e26406ffa4f79d9292e6
Author: Nick Clifton 
Date:   Fri Feb 12 14:52:22 2021 +

Change the readelf and objdump programs so that they will automatically
follow links to separate debug info files.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/27487] New: nm: Add --just-symbol-name

2021-02-28 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=27487

Bug ID: 27487
   Summary: nm: Add --just-symbol-name
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: i at maskray dot me
  Target Milestone: ---

llvm-nm supports --just-symbol-name which omits the address and the symbol key.

% llvm-nm -D --just-symbol-name =cat
_ITM_deregisterTMCloneTable
_ITM_registerTMCloneTable
__ctype_b_loc@GLIBC_2.3
__ctype_get_mb_cur_max@GLIBC_2.2.5
__cxa_atexit@GLIBC_2.2.5
__cxa_finalize@GLIBC_2.2.5
__errno_location@GLIBC_2.2.5
...

% llvm-nm --just-symbol-name a.o 
__llvm_profile_filename
__llvm_profile_raw_version
__profd_foo
__profd_main
foo
main
puts

Without the option, the user can pipe the output to cut

% nm a.o | cut -c20-

20 needs to be tuned for ELFCLASS32.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gold/27490] New: gold: Don't produce two output sections __llvm_prf_names

2021-02-28 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=27490

Bug ID: 27490
   Summary: gold: Don't produce two output sections
__llvm_prf_names
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: i at maskray dot me
CC: ian at airs dot com
  Target Milestone: ---

LLVM integrated assembler does not set EI_OSABI in the ELF header to
ELFOSABI_GNU for SHF_GNU_RETAIN usage. (LLVM does not have the "emulation"
concept. In a FreeBSD environment, arguably ELFOSABI_FREEBSD is better. For
other OSABI systems, perhaps other values should be used. Anycase, the
ELFOSABI_NONE choice is consistent with integrated assembler's handling with 
STT_GNU_IFUNC/STB_GNU_UNIQUE.)

cat > ./a.s < ./b.s
clang -c a.s b.s  # clang >= 12.0.0
# a.o b.o  are ELFOSABI_NONE
~/Dev/binutils-gdb/Debug/gold/ld-new a.o b.o

There are two __llvm_prf_names output sections. GNU ld produces just one.
llvm-cov show  errors if there are two __llvm_prf_names sections.

% readelf -WS a.out
There are 8 section headers, starting at offset 0x168:

Section Headers:
  [Nr] Name  TypeAddress  OffSize   ES Flg
Lk Inf Al
  [ 0]   NULL 00 00 00 
0   0  0
  [ 1] .text PROGBITS00400078 78 00 00  AX 
0   0  4
  [ 2] __llvm_prf_names  PROGBITS00400078 78 08 00   A 
0   0  1
  [ 3] __llvm_prf_names  PROGBITS00400080 80 00 00  Ao 
0   0  1
  [ 4] .note.gnu.gold-version NOTE 80 1c 00
 0   0  4
  [ 5] .symtab   SYMTAB   a0 60 18 
6   1  8
  [ 6] .strtab   STRTAB   000100 19 00 
0   0  1
  [ 7] .shstrtab STRTAB   000119 49 00 
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  l (large), p (processor specific)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/27128] nm -P portable output format regression

2021-02-28 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=27128

--- Comment #10 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=6a1224ec762f7dd59d7abd2e5dc3be26bb157cd1

commit 6a1224ec762f7dd59d7abd2e5dc3be26bb157cd1
Author: Alan Modra 
Date:   Sat Feb 27 15:39:05 2021 +1030

PR27128, nm -P portable output format regression

Add nm --without-symbol-versions.

binutils/
PR 27128
* doc/binutils.texi: Add nm --with-symbol-versions and
--without-symbol-versions documentation.
* nm.c (with_symbol_versions): New variable.
(enum long_option_values): Delete OPTION_WITH_SYMBOL_VERSIONS.
(long_options): Make --with-symbol-versions entry twiddle the flag.
Add --without-symbol-versions.
(print_symname): Strip version when !with_symbol_versions.  Add
dynamic version info under control of with_symbol_versions.
(main): Remove OPTION_WITH_SYMBOL_VERSIONS case.
ld/
* testsuite/ld-elf/pr25708.d: Add --with-symbol-versions to nm.
* testsuite/ld-elf/pr27128a.d: Likewise.
* testsuite/ld-elf/pr27128b.d: Likewise.
* testsuite/ld-elf/pr27128c.d: Likewise.
* testsuite/ld-elf/pr27128d.d: Likewise.
* testsuite/ld-elf/pr27128e.d: Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/27441] Small inconsistency in between gold and bfd

2021-02-28 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=27441

--- Comment #15 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=e3316baf921523e884731f5c7b547bc9362039e5

commit e3316baf921523e884731f5c7b547bc9362039e5
Author: Alan Modra 
Date:   Wed Feb 24 18:01:16 2021 +1030

PR27441, inconsistency in weak definitions

This makes IR objects use the same logic as normal objects with
respect to what sort of ref/def makes an as-needed library needed.
Testing the binding of the definition is just plain wrong.  What
matters is the binding of the reference.

PR 27441
* elf-bfd.h (struct elf_link_hash_entry): Add ref_ir_nonweak.
* elflink.c (elf_link_add_object_symbols): Set ref_ir_nonweak and
use when deciding an as-needed library should be loaded instead
of using the binding of the library definition.

(cherry picked from commit bbaddd4bbeba65200ee805d87c2e3a845842e3eb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/27451] ld: Provide a way to make C identifier name sections GCable under __start_/__stop_ references

2021-02-28 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=27451

--- Comment #3 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=8ee10e86093150c70360d9e26b29e6d9b6398f33

commit 8ee10e86093150c70360d9e26b29e6d9b6398f33
Author: Alan Modra 
Date:   Mon Mar 1 08:22:49 2021 +1030

PR27451, -z start_stop_gc

When --gc-sections is in effect, a reference from a retained section
to __start_SECNAME or __stop_SECNAME causes all input sections named
SECNAME to also be retained, if SECNAME is representable as a C
identifier and either __start_SECNAME or __stop_SECNAME is synthesized
by the linker.  Add an option to disable that feature, effectively
ignoring any relocation that references a synthesized linker defined
__start_ or __stop_ symbol.

PR 27451
include/
* bfdlink.h (struct bfd_link_info): Add start_stop_gc.
bfd/
* elflink.c (_bfd_elf_gc_mark_rsec): Ignore synthesized linker
defined start/stop symbols when start_stop_gc.
(bfd_elf_gc_mark_dynamic_ref_symbol): Likewise.
(bfd_elf_define_start_stop): Don't modify ldscript_def syms.
* linker.c (bfd_generic_define_start_stop): Likewise.
ld/
* emultempl/elf.em: Handle -z start-stop-gc and -z nostart-stop-gc.
* lexsup.c (elf_static_list_options): Display help for them.  Move
help for -z stack-size to here from elf_shlib_list_options. Add
help for -z start-stop-visibility and -z undefs.
* ld.texi: Document -z start-stop-gc and -z nostart-stop-gc.
* NEWS: Mention -z start-stop-gc.
* testsuite/ld-gc/start2.s,
* testsuite/ld-gc/start2.d: New test.
* testsuite/ld-gc/gc.exp: Run it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.