[Bug ld/24574] extern symbols in dlls are misleading under debugger

2019-09-05 Thread ebotcazou at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24574

--- Comment #11 from Eric Botcazou  ---
> I went ahead and dug into this a little bit more. First off, props for the
> great testcase, it was great to even have the gdb test routine automated.

Thanks for the analysis!  The __imp prefix has been dropped because I have
dropped this piece of code from pe_find_data_imports in the patch:

- /* We replace original name with __imp_ prefixed, this
-1) may trash memory 2) leads to duplicate symbol generation.
-Still, IMHO it's better than having name polluted.  */
- undef->root.string = sym->root.string;

-- 
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


[Bug ld/24574] extern symbols in dlls are misleading under debugger

2019-09-05 Thread ebotcazou at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24574

Eric Botcazou  changed:

   What|Removed |Added

URL||https://sourceware.org/ml/b
   ||inutils/2019-09/msg00013.ht
   ||ml

-- 
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


[Bug ld/24574] extern symbols in dlls are misleading under debugger

2019-09-05 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24574

--- Comment #12 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Eric Botcazou :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=de07a745805b28ed2c973635752719c4a6a32b1d

commit de07a745805b28ed2c973635752719c4a6a32b1d
Author: Eric Botcazou 
Date:   Thu Sep 5 18:23:37 2019 +0200

Fix PR ld/24574

This restores a line that has been dropped when the auto-import feature
of the PE-COFF linker was overhauled about one year.  It is necessary
for GDB to properly resolve extern symbol in DLLs.

ld/ChangeLog
* pe-dll.c (pe_find_data_imports): Replace again the original name
of the undefined symbol with the __imp_ prefixed one after it is
resolved.

-- 
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


[Bug ld/24574] extern symbols in dlls are misleading under debugger

2019-09-05 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24574

--- Comment #13 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_32-branch branch has been updated by Eric Botcazou
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6f7a2922078bde30ca6ec1391a30d79f59c87b9a

commit 6f7a2922078bde30ca6ec1391a30d79f59c87b9a
Author: Eric Botcazou 
Date:   Thu Sep 5 18:23:37 2019 +0200

Fix PR ld/24574

This restores a line that has been dropped when the auto-import feature
of the PE-COFF linker was overhauled about one year.  It is necessary
for GDB to properly resolve extern symbol in DLLs.

ld/ChangeLog
* pe-dll.c (pe_find_data_imports): Replace again the original name
of the undefined symbol with the __imp_ prefixed one after it is
resolved.

-- 
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


[Bug ld/24574] extern symbols in dlls are misleading under debugger

2019-09-05 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24574

--- Comment #14 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_31-branch branch has been updated by Eric Botcazou
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=34a30b6758db4fe53b2872d7bd3824c778f6118c

commit 34a30b6758db4fe53b2872d7bd3824c778f6118c
Author: Eric Botcazou 
Date:   Thu Sep 5 18:23:37 2019 +0200

Fix PR ld/24574

This restores a line that has been dropped when the auto-import feature
of the PE-COFF linker was overhauled about one year.  It is necessary
for GDB to properly resolve extern symbol in DLLs.

ld/ChangeLog
* pe-dll.c (pe_find_data_imports): Replace again the original name
of the undefined symbol with the __imp_ prefixed one after it is
resolved.

-- 
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


[Bug ld/24574] extern symbols in dlls are misleading under debugger

2019-09-05 Thread ebotcazou at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24574

Eric Botcazou  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.33

--- Comment #15 from Eric Botcazou  ---
This should work again now.

-- 
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


[Bug binutils/24968] New: objcopy: -B is not useful

2019-09-05 Thread maskray at google dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24968

Bug ID: 24968
   Summary: objcopy: -B is not useful
   Product: binutils
   Version: 2.33 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: maskray at google dot com
  Target Milestone: ---

objcopy -I binary -O elf64-x86-64 a.txt b # e_machine is
EM_NONE
objcopy -I binary -B i386:x86-64 -O elf64-x86-64 a.txt c  # e_machine is
EM_X86_64
cmp -l b c# one byte
difference: 19 0 76

objcopy -I ihex -O elf64-x86-64 a.hex b.o # e_machine is
EM_NONE
objcopy -I ihex -B i386:x86-64 -O elf64-x86-64 a.hex b.o  # e_machine is
EM_X86_64
cmp -l b c# one byte
difference: 19 0 76

aarch64/binutils/objcopy -I binary -O elf64-littleaarch64 a.txt b; file b
a.o: ELF 64-bit LSB relocatable, no machine, version 1 (SYSV), not stripped



This means when -I binary is used, both -O and -B have to be specified.
The e_machine information "i386:x86-64" can be inferred from elf64-x86-64.

So is it possible to ignore -B and let `objcopy -I binary -O elf*` create an
object file with e_machine set? This will not break existing use cases.


There is a precedent that ignores -B, elftoolchain elfcopy

case 'B':
  /* ignored */
  break;
  ...
case 'I':
case 's':
  set_input_target(ecp, optarg);
  break;
  ...
case 'O':
  set_output_target(ecp, optarg);
  break;

-- 
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