[Bug gold/21545] New: relro_test.sh can be simplified, eliminating dependency on dc

2017-06-03 Thread sourceware at jonathancottrill dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=21545

Bug ID: 21545
   Summary: relro_test.sh can be simplified, eliminating
dependency on dc
   Product: binutils
   Version: 2.27
Status: UNCONFIRMED
  Severity: minor
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: sourceware at jonathancottrill dot net
CC: ian at airs dot com
  Target Milestone: ---

Created attachment 10082
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10082&action=edit
[PATCH] Simplify gold relro_test; eliminate dc dependency

gold/testsuite/relro_test.sh does some unnecessarily complicated manipulation
of hex values, along with some arithmetic using dc. dc doesn't necessarily
exist on all systems trying to build and check binutils, and isn't needed
because the shell script can do the hex arithmetic, itself, using the $(())
construct.

For example:

RELRO_END=$((RELRO_START + RELRO_LEN))

...works fine with hex values prefixed with 0x stored in RELRO_START and
RELRO_LEN.

The end result is simpler and easier to follow. (I also simplified a couple of
grep/awk commands.) Please see the attached patch (against current master).

-- 
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 gold/21545] relro_test.sh can be simplified, eliminating dependency on dc

2017-12-07 Thread sourceware at jonathancottrill dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=21545

Jonathan Cottrill  changed:

   What|Removed |Added

 CC||sourceware@jonathancottrill
   ||.net

-- 
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/22571] New: libbfd: bfd_get_symtab_upper_bound causes SIGSEGV when iterating archive files

2017-12-07 Thread sourceware at jonathancottrill dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=22571

Bug ID: 22571
   Summary: libbfd: bfd_get_symtab_upper_bound causes SIGSEGV when
iterating archive files
   Product: binutils
   Version: 2.29
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: sourceware at jonathancottrill dot net
  Target Milestone: ---

Created attachment 10670
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10670&action=edit
Simple C program demonstrating SIGSEGV issue

In a symbol processing program I'm writing, I'm iterating through an archive,
using bfd_openr_next_archived_file followed by bfd_get_symtab_upper_bound. The
first iteration is successful, but the second file causes a SIGSEGV in the
bfd_get_symtab_upper_bound call. This seems to happen with any archive (I've
tried several Linux ELF .a archives, and one Windows COFF .lib archive).

A simplified case that demonstrates the problem is:

bfd* file = NULL;
while ((file = bfd_openr_next_archived_file(archive, file)) != NULL) {
printf("File: %s\n", file->filename);

long storage_needed = bfd_get_symtab_upper_bound(file);
printf("  symbol table: %li bytes\n", storage_needed);
}

Example output is:

File: file-a.o
  symbol table: 72 bytes
File: file-b.o
Segmentation fault (core dumped)

GDB shows:

Program received signal SIGSEGV, Segmentation fault.
0x779574c2 in _bfd_elf_get_symtab_upper_bound (abfd=0x607b20) at 
../../bfd/elf.c:8023
8023  symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;

If it matters, this is on openSUSE 42.3 x86_64, using either the system
libbfd-2.29.1.so library or building the library myself from your Git repo.

I've attached the file uselibbfd.c, a complete and simple program demonstrating
the issue. Also, I'll attach the coredump.

Please let me know what other information you need.

Thanks!


Notes:

I'm relying on documentation here for the libbfd calls I'm making:

https://sourceware.org/binutils/docs-2.29/bfd/Archives.html
https://sourceware.org/binutils/docs-2.29/bfd/Reading-Symbols.html

--
I can reproduce the problem with an archive built using:

ar rcs archive.a file-a.o file-b.o

...where file-a.o and file-b.o are compiled using gcc -c file-*.c, and the C
source files are simply:

file-a.c:
void functionA() {
}

file-b.c:
void functionB() {
}

-- 
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/22571] libbfd: bfd_get_symtab_upper_bound causes SIGSEGV when iterating archive files

2017-12-07 Thread sourceware at jonathancottrill dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=22571

Jonathan Cottrill  changed:

   What|Removed |Added

 CC||sourceware@jonathancottrill
   ||.net

--- Comment #1 from Jonathan Cottrill  
---
Created attachment 10671
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10671&action=edit
Coredump

-- 
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/22571] libbfd: bfd_get_symtab_upper_bound causes SIGSEGV when iterating archive files

2017-12-18 Thread sourceware at jonathancottrill dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=22571

--- Comment #4 from Jonathan Cottrill  
---
That indeed resolves my problem. :-) Thanks much for looking into it and
updating the docs!

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