[ipxe-devel] gcc defaults to pie ?

Joakim Tjernlund Joakim.Tjernlund at infinera.com
Wed Jan 31 18:52:02 UTC 2018


On Thu, 1970-01-01 at 00:00 +0000, Joakim Tjernlund wrote:
> On Thu, 1970-01-01 at 00:00 +0000, Michael Brown wrote:
> > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
> > 
> > 
> > On 31/01/18 17:31, Joakim Tjernlund wrote:
> > > Yes, building on x86_64 for x86_64, various targets, for example
> > > make -j1 Q=''   CC=x86_64-pc-linux-gnu-gcc LD=x86_64-pc-linux-gnu-ld AS=x86_64-pc-linux-gnu-as AR=x86_64-pc-
> > > linux-gnu-ar NM=x86_64-pc-linux-gnu-nm OBJCOPY=x86_64-pc-linux-gnu-objcopy RANLIB=x86_64-pc-linux-gnu-ranlib
> > > OBJDUMP=x86_64-pc-linux-gnu-objdump HOST_CC=x86_64-pc-linux-gnu-gcc ARCH=x86_64
> > > EMBED=/var/lib/layman/transmode/profiles/gentoo64-common/IPXE.script bin/808610de.rom
> > 
> > OK.  Don't do that.  Try just
> > 
> >    make EMBED=....../IPXE.script bin/808610de.rom
> > 
> > and it should automatically use the correct toolchain and build a 32-bit
> > binary (which _is_ what you want, since you've asked for
> > bin/808610de.rom rather than bin-x86_64-pcbios/808610de.rom).
> 
> Here is some confusion on my part, I added ARCH=x86_64 and figured
> that should do the right thing.
> Using make \
> 	EMBED=${IPXE_EMBED} 
> 
> I can build bin/8086100e.rom but not bin-x86_64-pcbios/8086100e.rom:
>   cc1: error: code model kernel does not support PIC mode
> nor
>   bin-x86_64-pcbios/undionly.kpxe 
>   bin-x86_64-pcbios/ipxe.lkrn
>   bin-x86_64-pcbios/ipxe.usb

adding this makes it build again:
 echo  "CFLAGS		+= -fno-pie" >> ${S}/arch/x86/Makefile.pcbios || die
 echo  "LDFLAGS		+= -no-pie" >> ${S}/arch/x86/Makefile.pcbios || die

Is that the correct place? There is an arch/x86_64/Makefile.pcbios file too

> 
> > In the unlikely even that you need to specify a custom toolchain (i.e.
> > if your default "gcc" binary is not an x86 compiler), then you can
> > specify an explicit toolchain prefix using CROSS:
> > 
> >    make CROSS=x86_64-pc-linux-gnu- \
> >         EMBED=....../IPXE.script \
> >         bin/808610de.rom
> > 
> > Michael


More information about the ipxe-devel mailing list