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 -0000 1.9 > +++ bfd/elf.c 26 Jul 2016 00:26:04 -0000 > @@ -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