[Bug ld/28398] binutils: ld: KEEP ignored

2021-09-30 Thread jrtc27 at jrtc27 dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28398

Jessica Clarke  changed:

   What|Removed |Added

 CC||jrtc27 at jrtc27 dot com

--- Comment #3 from Jessica Clarke  ---
1. That's because you need -Wl,--whole-archive to include all .o files in the
.a
2. Don't put a dot in the section names, make them valid C identifiers and use
the linker-generated __start_$section/__stop_$section names
3. You will need -Wl,-z,nostart-stop-gc for LLD 13+ because the maintainer
decided breaking coding patterns that have worked for decades is fine (binutils
also accepts the flag as of 2.37 but does not currently default to the broken
behaviour)

If you want a BSD-2-Clause-licensed linker set implementation you can grab
sys/sys/linker_set.h from FreeBSD and alter it however you like.

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


[Bug binutils/26206] Add pei-aarch64 support for native EFI support

2021-09-30 Thread tnfchris at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=26206

Tamar Christina  changed:

   What|Removed |Added

   Target Milestone|--- |2.38
   Assignee|unassigned at sourceware dot org   |tnfchris at sourceware 
dot org
 Status|NEW |ASSIGNED

--- Comment #9 from Tamar Christina  ---
Aiming for support for this in the next binutils release.

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


[Bug ld/28399] New: Flag to order functions in a specific order based on order file

2021-09-30 Thread hiraditya at msn dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28399

Bug ID: 28399
   Summary: Flag to order functions in a specific order based on
order file
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: hiraditya at msn dot com
  Target Milestone: ---

The BSD linker has this option `--symbol-ordering-file=file ` that
lays out functions (and possibly other symbols) in the order specified in order
file. I can't find similar flag in gnu ld. Using order file to generate binary
gives performance boost of ~5-10% in large binaries. It helps a lot with
program startup time as page faults during cold starts are reduced.

Reference to bsd linker: https://www.freebsd.org/cgi/man.cgi?ld(1)

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


[Bug binutils/28401] New: fail to allocate error in objdump at xmalloc.c:147

2021-09-30 Thread irfanariq at kaist dot ac.kr
https://sourceware.org/bugzilla/show_bug.cgi?id=28401

Bug ID: 28401
   Summary: fail to allocate error in objdump at xmalloc.c:147
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: irfanariq at kaist dot ac.kr
  Target Milestone: ---

Created attachment 13688
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13688&action=edit
poc and full stack trace

Hello,

We are currently working on fuzz testing feature, and we found a *failed to
allocate* error on `objdump`.

The stack traces are as follow:
```
==29580==WARNING: AddressSanitizer failed to allocate 0x4013034 bytes
==29580==AddressSanitizer CHECK failed:
../../../../src/libsanitizer/sanitizer_common/sanitizer_allocator.cc:218 "((0))
!= (0)" (0x0, 0x0)
#0 0x7ffa72d6ebf2  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9bf2)
#1 0x7ffa72d8d575 in __sanitizer::CheckFailed(char const*, int, char
const*, unsigned long long, unsigned long long)
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108575)
#2 0x7ffa72d74332  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xef332)
#3 0x7ffa72cace46  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x27e46)
#4 0x7ffa72d63b0a in __interceptor_malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb0a)
#5 0x55da08b7897b in xmalloc xmalloc.c:147
#6 0x55da079d8813 in load_specific_debug_section objdump.c:3643
#7 0x55da079d8fb5 in load_debug_section objdump.c:3740
#8 0x55da07a338ad in check_for_and_load_links
.../binutils-git/binutils/dwarf.c:11327
#9 0x55da07a33fdf in load_separate_debug_files
.../binutils-git/binutils/dwarf.c:11465
#10 0x55da079decd7 in dump_bfd objdump.c:4882
#11 0x55da079df994 in display_object_bfd objdump.c:5068
#12 0x55da079dfd2f in display_any_bfd objdump.c:5158
#13 0x55da079dfda6 in display_file objdump.c:5179
#14 0x55da079e115a in main objdump.c:5529
```
The full stack trace is attached.

**Step to reproduce**

We configured `objdump` using 

`CFLAGS="-g -O0 -fsanitize=address" ./configure --prefix=$(pwd)/
--disable-shared --enable-targets=all`

and built it using `make -j 10`, and run it with:

```
./objdump --disassembler-options=data16 --debugging-tags  -d
```

The input file is attached.

**Environment**
- OS: Ubuntu 18.04.5 LTS
- GCC version: gcc 7.5.0
- binutils version: commit (98ca73a) of master branch on sourceware git
([link](https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=98ca73afe51e1e921915c37f242c88d4d445841c))

Thank you.

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


[Bug binutils/28402] New: fail to allocate error in objdump at objalloc.c:143

2021-09-30 Thread irfanariq at kaist dot ac.kr
https://sourceware.org/bugzilla/show_bug.cgi?id=28402

Bug ID: 28402
   Summary: fail to allocate error in objdump at objalloc.c:143
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: irfanariq at kaist dot ac.kr
  Target Milestone: ---

Created attachment 13689
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13689&action=edit
poc and full stack trace

Hello,

We are currently working on fuzz testing feature, and we found a **failed to
allocate** error on `objdump`.

The stack traces are as follow:

==29506==ERROR: AddressSanitizer failed to allocate 0x8c9b9e000 (37744140288)
bytes of LargeMmapAllocator (error code: 12)
==29506==AddressSanitizer CHECK failed:
../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:118 "((0 &&
"unable to mmap")) != (0)" (0x0, 0x0)
#0 0x7f2253019bf2  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe9bf2)
#1 0x7f2253038575 in __sanitizer::CheckFailed(char const*, int, char
const*, unsigned long long, unsigned long long)
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0x108575)
#2 0x7f2253023482  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf3482)
#3 0x7f225302f895  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xff895)
#4 0x7f2252f587fd  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x287fd)
#5 0x7f225300eb0a in __interceptor_malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb0a)
#6 0x563b480a1792 in _objalloc_alloc objalloc.c:143
#7 0x563b473d1794 in bfd_alloc .../binutils-git/bfd/opncls.c:1032
#8 0x563b47677b8e in coff_slurp_line_table
.../binutils-git/bfd/coffcode.h:4374
#9 0x563b4767a917 in coff_slurp_symbol_table
.../binutils-git/bfd/coffcode.h:4915
#10 0x563b4767ae4d in coff_slurp_reloc_table
.../binutils-git/bfd/coffcode.h:5090
#11 0x563b4767be5c in coff_canonicalize_reloc
.../binutils-git/bfd/coffcode.h:5238
#12 0x563b473b99f2 in bfd_canonicalize_reloc
.../binutils-git/bfd/bfd.c:1579
#13 0x563b46f08bef in disassemble_section objdump.c:3202
#14 0x563b473d53c0 in bfd_map_over_sections
.../binutils-git/bfd/section.c:1383
#15 0x563b46f0b293 in disassemble_data objdump.c:3599
#16 0x563b46f126cc in dump_bfd objdump.c:5006
#17 0x563b46f12994 in display_object_bfd objdump.c:5068
#18 0x563b46f12d2f in display_any_bfd objdump.c:5158
#19 0x563b46f12da6 in display_file objdump.c:5179
#20 0x563b46f1415a in main objdump.c:5529

The full stack trace is attached.

**Step to reproduce**

We configured `objdump` using 

```
CFLAGS="-g -O0 -fsanitize=address" ./configure --prefix=$(pwd)/
--disable-shared --enable-targets=all
```

and built it using `make -j 10`, and run it with:

```
./objdump  --no-show-raw-insn --show-raw-insn i8086
--file-offsets -S booke --debugging --disassembler-options=addr16 -r --demangle
```

The input file is attached.

**Environment**
- OS: Ubuntu 18.04.5 LTS
- GCC version: gcc 7.5.0
- binutils version: commit (98ca73a) of master branch on sourceware git
([link](https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=98ca73afe51e1e921915c37f242c88d4d445841c))

Thank you.

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


[Bug binutils/28403] New: segv in objdump at disassemble_bytes (objdump.c:3055)

2021-09-30 Thread irfanariq at kaist dot ac.kr
https://sourceware.org/bugzilla/show_bug.cgi?id=28403

Bug ID: 28403
   Summary: segv in objdump at disassemble_bytes (objdump.c:3055)
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: irfanariq at kaist dot ac.kr
  Target Milestone: ---

Created attachment 13690
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13690&action=edit
poc and full stack trace

Hello,

We are currently working on fuzz testing feature, and we found a **SEGV** on
`objudmp`.

The stack traces are as follow:
```
==29560==ERROR: AddressSanitizer: SEGV on unknown address 0x000d (pc
0x7fc403774e22 bp 0x7ffdb4b14de0 sp 0x7ffdb4b144f8 T0)
==29560==The signal is caused by a READ memory access.
==29560==Hint: address points to the zero page.
#0 0x7fc403774e21  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xfce21)
#1 0x7fc4036ec31f  (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x7431f)
#2 0x7fc4036ecdad in vprintf
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0x74dad)
#3 0x7fc4036ece9e in __interceptor_printf
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0x74e9e)
#4 0x55a8f375de5f in disassemble_bytes objdump.c:3055
#5 0x55a8f3760342 in disassemble_section objdump.c:3455
#6 0x55a8f3c2b3c0 in bfd_map_over_sections
.../binutils-git/bfd/section.c:1383
#7 0x55a8f3761293 in disassemble_data objdump.c:3599
#8 0x55a8f37686cc in dump_bfd objdump.c:5006
#9 0x55a8f3768994 in display_object_bfd objdump.c:5068
#10 0x55a8f3768d2f in display_any_bfd objdump.c:5158
#11 0x55a8f3768cd9 in display_any_bfd objdump.c:5139
#12 0x55a8f3768da6 in display_file objdump.c:5179
#13 0x55a8f376a15a in main objdump.c:5529
```
Here is the full stack trace : [link]()

**Step to reproduce**

We configured `objudmp` using 

`CFLAGS="-g -O0 -fsanitize=address" ./configure --prefix=$(pwd)/
--disable-shared --enable-targets=all` 

and build it using `make -j 10`, and run it with:

```
./objdump data16 -marm i8086 64 -Ttext --headers  ppcps
--debugging --wide --demangle 440 --dwarf --file-offsets --line-numbers
--disassemble nm -d -Wa
```

The input file is attached.

**Environment**
- OS: Ubuntu 18.04.5 LTS
- GCC version: gcc 7.5.0
- binutils version: commit (98ca73a) of master branch on sourceware git
([link](https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=98ca73afe51e1e921915c37f242c88d4d445841c))

Thank you.

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