[Bug binutils/22769] crash when running 32-bit objdump on corrupted file

2018-01-31 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22769

Alan Modra  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-02-01
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com
 Ever confirmed|0   |1

-- 
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 admin/22768] Hello

2018-01-31 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22768

Alan Modra  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Alan Modra  ---
spam

-- 
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/22769] New: crash when running 32-bit objdump on corrupted file

2018-01-31 Thread lrk700 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22769

Bug ID: 22769
   Summary: crash when running 32-bit objdump on corrupted file
   Product: binutils
   Version: 2.31 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: lrk700 at gmail dot com
  Target Milestone: ---

Created attachment 10765
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10765&action=edit
POC file

Hi,

Here's another file that crashes `objdump -g`. The build environment is the
same as https://sourceware.org/bugzilla/show_bug.cgi?id=22746(I built 32-bit
objdump on a 64-bit machine by setting CFLAGS and LDFLAGS to `-m32`).

The code we're using is update to the HEAD:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=35f48e217ab6f909510bf9ca07325ec16122ae88

Here's the output on the POC file:



root@debian:~# ~/src/binutils-32/binutils/objdump -g c3

c3: file format elf32-i386

*** Error in `/root/src/binutils-32/binutils/objdump': free(): invalid next
size (fast): 0x56fd21e0 ***
=== Backtrace: =
/lib/i386-linux-gnu/libc.so.6(+0x6737a)[0xf764337a]
/lib/i386-linux-gnu/libc.so.6(+0x6dfb7)[0xf7649fb7]
/lib/i386-linux-gnu/libc.so.6(+0x6e7f6)[0xf764a7f6]
/root/src/binutils-32/binutils/objdump(+0x26617)[0x565ed617]
/root/src/binutils-32/binutils/objdump(+0x262cd)[0x565ed2cd]
/root/src/binutils-32/binutils/objdump(+0x267fd)[0x565ed7fd]
/root/src/binutils-32/binutils/objdump(+0x90242)[0x56657242]
/root/src/binutils-32/binutils/objdump(+0x269b3)[0x565ed9b3]
/root/src/binutils-32/binutils/objdump(+0x28e15)[0x565efe15]
/root/src/binutils-32/binutils/objdump(+0x28ee6)[0x565efee6]
/root/src/binutils-32/binutils/objdump(+0x2913a)[0x565f013a]
/root/src/binutils-32/binutils/objdump(+0x291b5)[0x565f01b5]
/root/src/binutils-32/binutils/objdump(main+0x9f6)[0x565f0bd7]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf6)[0xf75f4276]
/root/src/binutils-32/binutils/objdump(+0x20cf1)[0x565e7cf1]
=== Memory map: 
565c7000-567aa000 r-xp  08:01 673613
/root/src/binutils-32/binutils/objdump
567ab000-56814000 r--p 001e3000 08:01 673613
/root/src/binutils-32/binutils/objdump
56814000-56819000 rw-p 0024c000 08:01 673613
/root/src/binutils-32/binutils/objdump
56819000-5682 rw-p  00:00 0
56fcd000-56fee000 rw-p  00:00 0  [heap]
f730-f7321000 rw-p  00:00 0
f7321000-f740 ---p  00:00 0
f740c000-f7428000 r-xp  08:01 1047386   
/lib/i386-linux-gnu/libgcc_s.so.1
f7428000-f7429000 r--p 0001b000 08:01 1047386   
/lib/i386-linux-gnu/libgcc_s.so.1
f7429000-f742a000 rw-p 0001c000 08:01 1047386   
/lib/i386-linux-gnu/libgcc_s.so.1
f743f000-f75da000 r--p  08:01 921179
/usr/lib/locale/locale-archive
f75da000-f75dc000 rw-p  00:00 0
f75dc000-f778d000 r-xp  08:01 1047406   
/lib/i386-linux-gnu/libc-2.24.so
f778d000-f778e000 ---p 001b1000 08:01 1047406   
/lib/i386-linux-gnu/libc-2.24.so
f778e000-f779 r--p 001b1000 08:01 1047406   
/lib/i386-linux-gnu/libc-2.24.so
f779-f7791000 rw-p 001b3000 08:01 1047406   
/lib/i386-linux-gnu/libc-2.24.so
f7791000-f7794000 rw-p  00:00 0
f7794000-f7797000 r-xp  08:01 1047460   
/lib/i386-linux-gnu/libdl-2.24.so
f7797000-f7798000 r--p 2000 08:01 1047460   
/lib/i386-linux-gnu/libdl-2.24.so
f7798000-f7799000 rw-p 3000 08:01 1047460   
/lib/i386-linux-gnu/libdl-2.24.so
f77a4000-f77a5000 rw-p  00:00 0
f77a5000-f77ac000 r--s  08:01 131640
/usr/lib/i386-linux-gnu/gconv/gconv-modules.cache
f77ac000-f77ae000 r--p 00199000 08:01 921179
/usr/lib/locale/locale-archive
f77ae000-f77b1000 rw-p  00:00 0
f77b1000-f77b3000 r--p  00:00 0  [vvar]
f77b3000-f77b5000 r-xp  00:00 0  [vdso]
f77b5000-f77d8000 r-xp  08:01 1045240   
/lib/i386-linux-gnu/ld-2.24.so
f77d8000-f77d9000 r--p 00022000 08:01 1045240   
/lib/i386-linux-gnu/ld-2.24.so
f77d9000-f77da000 rw-p 00023000 08:01 1045240   
/lib/i386-linux-gnu/ld-2.24.so
ffbe3000-ffc04000 rw-p  00:00 0 
[stack]
Aborted



Thanks!

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

[Bug ld/20402] ld.bfd for emits *_RELATIVE relocations against SHN_ABS symbols

2018-01-31 Thread egeyar.bagcioglu at oracle dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20402

Egeyar Bagcioglu  changed:

   What|Removed |Added

 CC||egeyar.bagcioglu at oracle dot 
com

-- 
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/22263] -fpie -pie generates dynamic relocations in text section

2018-01-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22263

H.J. Lu  changed:

   What|Removed |Added

 CC||bugdal at aerifal dot cx

--- Comment #14 from H.J. Lu  ---
*** Bug 22570 has been marked as a duplicate of this bug. ***

-- 
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/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-01-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #4 from H.J. Lu  ---
Dup.

*** This bug has been marked as a duplicate of bug 22263 ***

-- 
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/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-01-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

--- Comment #3 from H.J. Lu  ---
This looks like a dup of PR 22263.

-- 
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 admin/22768] New: Hello

2018-01-31 Thread andy.sekolah at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22768

Bug ID: 22768
   Summary: Hello
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: admin
  Assignee: unassigned at sourceware dot org
  Reporter: andy.sekolah at gmail dot com
  Target Milestone: ---

Created attachment 10764
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10764&action=edit
Hello

Hello

-- 
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/22764] [2.30 Regression] ld fails to link 4.13 and 4.15 kernels on aarch64-linux-gnu

2018-01-31 Thread peter.smith at linaro dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22764

Peter Smith  changed:

   What|Removed |Added

 CC||peter.smith at linaro dot org

--- Comment #5 from Peter Smith  ---
I think that the new error message for R_AARCH64_ABS32 from the linker makes
some sense if the destination symbol is section relative as there is no dynamic
relocation supported and truncating a 64-bit address is most likely a mistake.

However if the destination symbol is absolute the linker shouldn't make the
assumption that the symbol is an address so it should resolve the relocation at
static link-time.

I think the test:
case BFD_RELOC_AARCH64_16:
#if ARCH_SIZE == 64
case BFD_RELOC_AARCH64_32:
#endif
  if (bfd_link_pic (info)
  && (sec->flags & SEC_ALLOC) != 0
  && (sec->flags & SEC_READONLY) != 0)
... Give error message
Should check that the symbol is not absolute as well.

Unfortunately I can't think of a workaround for the case where the value of the
symbols has to be in the RO-segment. For some reason the check only applies in
RO sections, which does not make a lot of sense to me as a R_AARCH64_ABS32 from
a RW section to an address will truncate it in the same way as if it were from
a RO section. No dynamic relocation is generated for either RO or RW so I don't
know why the distinction has been made.

-- 
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/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-01-31 Thread bugdal at aerifal dot cx
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

--- Comment #2 from Rich Felker  ---
Created attachment 10762
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10762&action=edit
proposed fix

-- 
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/22570] ld fails to bind DTPMOD at link time for pie on mips

2018-01-31 Thread bugdal at aerifal dot cx
https://sourceware.org/bugzilla/show_bug.cgi?id=22570

--- Comment #1 from Rich Felker  ---
The details of my assessment seem to have been written in terms of 2.25; with
the changes from commit 0e1862bb40, the problem is now use of bfd_link_pic
where bfd_link_dll was presumably intended. I'm attaching a patch which seems
to correct the issue.

-- 
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/14170] ld: assertion fail /export/gnu/import/git/binutils/bfd/linker.c:641

2018-01-31 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=14170

--- Comment #8 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

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

commit 8988502d75343349cee39575c0e4a0b33f7c80e0
Author: Maciej W. Rozycki 
Date:   Wed Jan 31 14:47:12 2018 +

MIPS/LD/testsuite: Correct dynamic links with VR4100, VR4300 and VR5000

Correct LD test suite failures with VR4100, VR4300 and VR5000 bare metal
MIPS/ELF targets which do not default to linking with shared libraries,
which leads to link failures like:

.../ld/ld-new: cannot find -lcomm-data
FAIL: Common symbol override test

or:

.../ld/ld-new: attempted static link of dynamic object `tmpdir/pr14170.so'
FAIL: PR ld/14170

removing:

FAIL: Build pr22471b.so
FAIL: Build pr22471
FAIL: Build pr22649-2b.so
FAIL: Build pr22649-2d.so
FAIL: Build pr22150
FAIL: PR ld/14170
FAIL: --gc-sections with __gxx_personality

test failures.

ld/
* testsuite/ld-elf/comm-data.exp: Pass `-call_shared' to links
involving a shared library for `mips*vr4100*-*-elf*',
`mips*vr4300*-*-elf*' and `mips*vr5000*-*-elf*' targets.
* testsuite/ld-elf/provide-hidden.exp: Likewise.
* testsuite/ld-elf/shared.exp: Likewise.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-mips-elf/comm-data.exp: Likewise.

-- 
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/21964] __start_SCN symbols aren't exported anymore

2018-01-31 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21964

--- Comment #8 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=823143c6ca8ef4267e67ba03771991e08d09fabd

commit 823143c6ca8ef4267e67ba03771991e08d09fabd
Author: H.J. Lu 
Date:   Wed Jan 31 05:10:40 2018 -0800

Check if __start/__stop symbols are referenced by shared objects

Define  __start/__stop symbols if they are referenced by shared objects,
not if they are also defined in shared objects.

bfd/

PR ld/21964
* elflink.c (bfd_elf_define_start_stop): Check if __start and
__stop symbols are referenced by shared objects.

ld/

PR ld/21964
* testsuite/ld-elf/pr21964-4.c: New file.
* testsuite/ld-elf/shared.exp: Run pr21964-4 test on Linux.

-- 
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/22764] [2.30 Regression] ld fails to link 4.13 and 4.15 kernels on aarch64-linux-gnu

2018-01-31 Thread ard.biesheuvel at linaro dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22764

--- Comment #4 from Ard Biesheuvel  ---
(In reply to H.J. Lu from comment #3)
> (In reply to Ard Biesheuvel from comment #2)
> > 
> > One could argue that absolute relocations against *absolute* ELF symbols
> > should always be resolved at static link time, but I am aware that, for
> > historical reasons, symbols like __GLOBAL_OFFSET_TABLE__ are emitted as
> > absolute, making this difficult to realise in practice.
> 
> Not true on x86:
> 
>   3987: 003dd000 0 OBJECT  LOCAL  DEFAULT   33
> _GLOBAL_OFFSET_TABLE_

Oh right.

Well, in any case, please refer to this ticket

https://sourceware.org/bugzilla/show_bug.cgi?id=20402

and the link in the comments for more discussion on this topic.

-- 
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/22764] [2.30 Regression] ld fails to link 4.13 and 4.15 kernels on aarch64-linux-gnu

2018-01-31 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22764

--- Comment #3 from H.J. Lu  ---
(In reply to Ard Biesheuvel from comment #2)
> 
> One could argue that absolute relocations against *absolute* ELF symbols
> should always be resolved at static link time, but I am aware that, for
> historical reasons, symbols like __GLOBAL_OFFSET_TABLE__ are emitted as
> absolute, making this difficult to realise in practice.

Not true on x86:

  3987: 003dd000 0 OBJECT  LOCAL  DEFAULT   33
_GLOBAL_OFFSET_TABLE_

-- 
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/22764] [2.30 Regression] ld fails to link 4.13 and 4.15 kernels on aarch64-linux-gnu

2018-01-31 Thread ard.biesheuvel at linaro dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22764

--- Comment #2 from Ard Biesheuvel  ---
>From commit 79e741920446582bd0e09f3e2b9f899c258efa56

R_AARCH64_ABS64 under LP64 is allowed in shared object and a dynamic
relocation entry
will be generated. This allows the dynamic linker to do further symbol
resolution.
R_AARCH64_ABS32 likewise is allowed in shared object, however under ILP32
abi.

The original behavior for R_AARCH64_ABS32 under LP64 is that, it's allowed
in shared object and silently resolved at static linking time.
No dynamic relocation entry is generate for it.

One could argue that absolute relocations against *absolute* ELF symbols should
always be resolved at static link time, but I am aware that, for historical
reasons, symbols like __GLOBAL_OFFSET_TABLE__ are emitted as absolute, making
this difficult to realise in practice.

-- 
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/22764] [2.30 Regression] ld fails to link 4.13 and 4.15 kernels on aarch64-linux-gnu

2018-01-31 Thread ard.biesheuvel at linaro dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22764

Ard Biesheuvel  changed:

   What|Removed |Added

 CC||ard.biesheuvel at linaro dot 
org

--- Comment #1 from Ard Biesheuvel  ---
The arm64 Linux kernel uses absolute ELF symbols to expose various build time
constants whose values are only known after linking to the program itself.

The size of the loadable image in little endian format (even on BE builds)
The memory footprint of the image in LE
The offset to and size of the RELA section, relative to the start of the image
(on KASLR kernels)

 A _kernel_flags_le_hi32
000a A _kernel_flags_le_lo32
 A _kernel_offset_le_hi32
0008 A _kernel_offset_le_lo32
 A _kernel_size_le_hi32
013b5000 A _kernel_size_le_lo32
004afa00 A __pecoff_data_rawsize
0051d000 A __pecoff_data_size
0200 A PECOFF_FILE_ALIGNMENT
00fa3898 A __rela_offset
002e2ab0 A __rela_size

The KASLR kernel is a PIE executable, and is no longer allowed to refer to
these symbols via R_AARCH64_ABS32 relocations, resulting in the build error
reported by Matthias.

So please explain how a PIE executable should refer to such absolute ELF
symbols if not via R_AARCH64_ABS32 relocations.

-- 
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/22764] New: [2.30 Regression] ld fails to link 4.13 and 4.15 kernels on aarch64-linux-gnu

2018-01-31 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22764

Bug ID: 22764
   Summary: [2.30 Regression] ld fails to link 4.13 and 4.15
kernels on aarch64-linux-gnu
   Product: binutils
   Version: 2.30
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: doko at debian dot org
  Target Milestone: ---

seen with 4.13 and 4.15 kernel builds, works with the 2.29 branch,
aarch64-linux-gnu.
log at
https://launchpadlibrarian.net/355195922/buildlog_ubuntu-bionic-arm64.linux_4.15.0-6.7_BUILDING.txt.gz

  LD  vmlinux.o
  MODPOST vmlinux.o
ld: arch/arm64/kernel/head.o: relocation R_AARCH64_ABS32 against
`_kernel_offset_le_lo32' can not be used when making a shared object
ld: arch/arm64/kernel/efi-entry.stub.o: relocation R_AARCH64_ABS32 against
`__efistub_stext_offset' can not be used when making a shared object
arch/arm64/kernel/head.o: In function `kimage_vaddr':
(.idmap.text+0x0): dangerous relocation: unsupported relocation
arch/arm64/kernel/head.o: In function `__primary_switch':
/<>/arch/arm64/kernel/head.S:772:(.idmap.text+0x340): dangerous
relocation: unsupported relocation
/<>/arch/arm64/kernel/head.S:772:(.idmap.text+0x348): dangerous
relocation: unsupported relocation
/<>/Makefile:1026: recipe for target 'vmlinux' failed
make[2]: *** [vmlinux] Error 1

-- 
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/22764] [2.30 Regression] ld fails to link 4.13 and 4.15 kernels on aarch64-linux-gnu

2018-01-31 Thread doko at debian dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=22764

Matthias Klose  changed:

   What|Removed |Added

 Target||aarch64-linux-gnu

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