Re: macppc: ld: a.out: Not enough room for program headers (allocated 12, need 13)
On Mon, Jul 25, 2016 at 6:48 PM, Juan Francisco Cantero Hurtadowrote: > Your patch fixes the problem. Thanks! Thanks for the report; it's been committed for 6.0. Philip Guenther
Re: macppc: ld: a.out: Not enough room for program headers (allocated 12, need 13)
On Mon, Jul 25, 2016 at 05:30:47PM -0700, Philip Guenther wrote: > On Tue, 26 Jul 2016, Juan Francisco Cantero Hurtado wrote: > > I've updated my powerbook to the latest snapshot today. I can't build a > > simple C program with the option -Wl,-z,wxneeded. The linker always > > shows the same error. > > > > # gcc test.c > > # gcc -Wl,-z,wxneeded test.c > > /usr/bin/ld: a.out: Not enough room for program headers (allocated 12, need > > 13) > ... > > /usr/bin/ld: final link failed: Bad value > > collect2: ld returned 1 exit status > > I think this solves it, or at least it does on my macppc. Your patch fixes the problem. Thanks! > Index: bfd/elf.c > === > RCS file: /data/src/openbsd/src/gnu/usr.bin/binutils-2.17/bfd/elf.c,v > retrieving revision 1.9 > diff -u -p -r1.9 elf.c > --- bfd/elf.c 31 May 2016 17:05:03 - 1.9 > +++ bfd/elf.c 26 Jul 2016 00:26:04 - > @@ -4731,6 +4731,12 @@ get_program_header_size (bfd *abfd) >++segs; > } > > + if (elf_tdata (abfd)->wxneeded) > +{ > + /* We need a PT_OPENBSD_WXNEEDED segment. */ > + ++segs; > +} > + >for (s = abfd->sections; s != NULL; s = s->next) > { >if ((s->flags & SEC_LOAD) != 0 > -- Juan Francisco Cantero Hurtado http://juanfra.info
Re: macppc: ld: a.out: Not enough room for program headers (allocated 12, need 13)
On Tue, 26 Jul 2016, Juan Francisco Cantero Hurtado wrote: > I've updated my powerbook to the latest snapshot today. I can't build a > simple C program with the option -Wl,-z,wxneeded. The linker always > shows the same error. > > # gcc test.c > # gcc -Wl,-z,wxneeded test.c > /usr/bin/ld: a.out: Not enough room for program headers (allocated 12, need > 13) ... > /usr/bin/ld: final link failed: Bad value > collect2: ld returned 1 exit status I think this solves it, or at least it does on my macppc. Philip Index: bfd/elf.c === RCS file: /data/src/openbsd/src/gnu/usr.bin/binutils-2.17/bfd/elf.c,v retrieving revision 1.9 diff -u -p -r1.9 elf.c --- bfd/elf.c 31 May 2016 17:05:03 - 1.9 +++ bfd/elf.c 26 Jul 2016 00:26:04 - @@ -4731,6 +4731,12 @@ get_program_header_size (bfd *abfd) ++segs; } + if (elf_tdata (abfd)->wxneeded) +{ + /* We need a PT_OPENBSD_WXNEEDED segment. */ + ++segs; +} + for (s = abfd->sections; s != NULL; s = s->next) { if ((s->flags & SEC_LOAD) != 0
macppc: ld: a.out: Not enough room for program headers (allocated 12, need 13)
I've updated my powerbook to the latest snapshot today. I can't build a simple C program with the option -Wl,-z,wxneeded. The linker always shows the same error. # gcc test.c # gcc -Wl,-z,wxneeded test.c /usr/bin/ld: a.out: Not enough room for program headers (allocated 12, need 13) Section to Segment mapping: Segment Sections... 00: PHDR: 01: INTERP: .interp 02: LOAD: .interp .note.openbsd.ident .hash .dynsym .dynstr .rela.dyn .rela.plt .init .text .fini 03: LOAD: .eh_frame 04: LOAD: .openbsd.randomdata .jcr .dynamic .data 05: LOAD: .got .ctors .dtors 06: LOAD: .sdata 07: LOAD: .plt 08: LOAD: .bss 09:DYNAMIC: .dynamic 10: NOTE: .note.openbsd.ident 11: OPENBSD_WXNEED: 12: OPENBSD_RANDOM: .openbsd.randomdata /usr/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status # cat test.c int main() { return 0; } -- Juan Francisco Cantero Hurtado http://juanfra.info