On Sat, 7 Dec 2013 10:46:13 +0000, Stuart Henderson wrote: > On 2013/12/06 17:05, Michael Brown wrote: > > On 02/12/13 14:59, Jiri B wrote: > > ># gmake bin/undionly.kpxe > > > [BIN] bin/undionly.kpxe.bin > > > [ZINFO] bin/undionly.kpxe.zinfo > > > [ZBIN] bin/undionly.kpxe.zbin > > >Add at 0x787 outside output buffer > > >Makefile.housekeeping:1052: recipe for target 'bin/undionly.kpxe.zbin' > > >failed > > >gmake: *** [bin/undionly.kpxe.zbin] Error 1 > > >gmake: *** Deleting file 'bin/undionly.kpxe.zbin' > > >rm bin/undionly.kpxe.zinfo bin/undionly.kpxe.bin > > > > > ># cat -n Makefile.housekeeping | sed -n '1049,1054p' > > > 1049 # Compress raw binary file > > > 1050 # > > > 1051 $(BIN)/%.zbin : $(BIN)/%.bin $(BIN)/%.zinfo $(ZBIN) > > > 1052 $(QM)$(ECHO) " [ZBIN] $@" > > > 1053 $(Q)$(ZBIN) $(BIN)/$*.bin $(BIN)/$*.zinfo> $@ > > > 1054 > > >-%- > > > > > >Any idea? Old GNU ld on OpenBSD, any workaround? > > > > For reference, this should be fixed as of commit > > > > http://git.ipxe.org/ipxe.git/commitdiff/1403bda > > > > Michael > > > > They're not exactly dynamically linked, but PIE is used by default > in OpenBSD (opt-out rather than opt-in; every program uses PIE unless > specifically told not to). > > So, even though the files are statically linked, they still use > ld.so which handles the relocation. > > The more accurate fix would probably be using "-fno-pie" rather than > "-static". (-static implies -fno-pie).
Correction: -static implies -nopie (linker flag), not -fno-pie (compiler flag). -fno-pie: Do not generate position-independent code -nopie: Do not try to link a position-independent binary So a program that wishes to turn off PIE should use -fno-pie while compiling and -static while linking. Also note that -nopie is an OpenBSD-only flag, so for a portable project, it is probably better to rely on the fact that -static implies -nopie. > c.f. memtest86+, > http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/sysutils/memtest86+/patches/patch-Makefile > >