Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Feb 2015 18:44:05 +1100
From:      Dewayne Geraghty <dewayne.geraghty@heuristicsystems.com.au>
To:        FreeBSD Stable Mailing List <freebsd-stable@freebsd.org>
Subject:   Requested to rebuild /usr/lib/crt1.o with fPIC during vsftpd build
Message-ID:  <54CF2AC5.1000508@heuristicsystems.com.au>

next in thread | raw e-mail | index | archive | help
While trying to build ftp/vsftpd with different values of -march and
gcc48, I receive this message  (on 10.1Stable r277875M, amd64)
/usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against
`_DYNAMIC' can not be used when making a shared object; recompile with -fPIC

Should I "just" add -fPIC to /usr/src/lib/csu/amd64/Makefile
CFLAGS+=        -fno-omit-frame-pointer -fPIC

What are the likely ramifications?


Detail
cd /usr/ports/ftp/vsftpd && make clean deinstall package
...
/usr/local/bin/gcc48 -o vsftpd main.o utility.o prelogin.o ftpcmdio.o
postlogin.o privsock.o  tunables.o ftpdataio.o secbuf.o ls.o 
postprivparent.o logging.o str.o netstr.o sysstr.o strlist.o  banner.o
filestr.o parseconf.o secutil.o  ascii.o oneprocess.o twoprocess.o
privops.o standalone.o hash.o  tcpwrap.o ipaddrparse.o access.o
features.o readwrite.o opts.o  ssl.o sslslave.o ptracesandbox.o
ftppolicy.o sysutil.o sysdeputil.o  seccompsandbox.o -lssp_nonshared
-Wl,-rpath,/usr/local/lib -L/usr/local/lib -fPIE -pie -Wl,-z,relro
-Wl,-z,now `./vsf_findlibs.sh`

/usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against
`_DYNAMIC' can not be used when making a shared object; recompile with -fPIC
/usr/lib/crt1.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
*** [vsftpd] Error code 1

In this case, I'm using CFLAGS of
-O2 -pipe -g0 -ggdb0 -DSTRIP_FBSDID -UDEBUGGING -UEBUGGING -UDEBUG -fPIC
-march=core2 -mtune=core2  -I/usr/local/include -fno-strict-aliasing
-fPIE -fstack-protector --param=ssp-buffer-size=4  -Wall -W -Wshadow
-Werror -Wformat-security  -D_FORTIFY_SOURCE=2

I'm surprised that gcc is requesting that I rebuild crt1.o with -fPIC,
while clang happily builds ftp/vsftpd.   More importantly, are there any
negative ramifications of building crt1 with -fPIC??

Examining the /usr/src/lib/csu/amd64/Makefile, which contains:
Scrt1.s: crt1.c
        ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c
        sed ${SED_FIX_NOTE} ${.TARGET}

makes this request very confusing!

Regards, Dewayne




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54CF2AC5.1000508>