Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pcc, -fPIC



On Wed, Sep 07, 2011 at 01:58:28PM +0000, bch%methodlogic.net@localhost wrote:
> On Wed, Sep 07, 2011 at 08:30:41AM +0100, Iain Hibbert wrote:
> > On Wed, 7 Sep 2011, bch%methodlogic.net@localhost wrote:
> > 
> > > I'm having issue w/ pcc creating .so's. Specifically, when using the -fPIC
> > > flag, ld(1) complains that the binaries are not compiled w/ -fPIC. I've
> > > got a fairly recent -current, pcc version 1.1.0.DEVEL 20110901.
> > >
> > > I don't actually use pcc that often, so can't say this used to work but
> > > broke afer [date xyz].
> > 
> > I run i386 builds with pcc fairly regularly (partial builds anyway, I have
> > a script that runs through most of what I know can be compiled) and have
> > seen no problems like that lately, what arch are you using and how do you
> > invoke pcc?
> 
> I'm running amd64; my project is simple by comparison. It my project
> *does* compile using gcc, but is linking against libs also compiled w/
> gcc. Could be the pcc generated code in my project is not compatible w/
> the gcc libs on the system?
> 
> Thanks for your sample output. I'll try to reduce my steps until I get
> _something_ that builds, and make things more complex until it fails.

So far, it appears I'm running into issues linking against gcc-compiled
libs wrt PIC code (PIC is not recognized). Ian, have you worked with
switches in gcc for compatibility (ie: -fpcc-struct-return), or have
any insight into my predicament?

-bch


> > below are the two alternative invocations that I use, in libbsdmalloc with
> > the pcc from -current (you don't need MKLINT=no MKMAN=no I just added that
> > to cut down on output)
> > 
> > iain
> > 
> > 
> > % make CC=pcc USETOOLS=no MKLINT=no MKMAN=no
> > #   compile  libbsdmalloc/malloc.o
> > pcc -O2 -std=gnu99  -Wall -Wstrict-prototypes -Wmissing-prototypes 
> > -Wpointer-arith -Wno-sign-compare  -Wno-traditional  -Wa,--fatal-warnings 
> > -Wreturn-type -Wswitch -Wshadow -Werror     -D_REENT -D_REENTRANT 
> > -I/home/plunky/src/lib/libbsdmalloc/../libc/include/  -c    malloc.c -o 
> > malloc.o
> > objcopy -x malloc.o
> > #   compile  libbsdmalloc/malloc.pico
> > pcc -O2 -std=gnu99  -Wall -Wstrict-prototypes -Wmissing-prototypes 
> > -Wpointer-arith -Wno-sign-compare  -Wno-traditional  -Wa,--fatal-warnings 
> > -Wreturn-type -Wswitch -Wshadow -Werror     -D_REENT -D_REENTRANT 
> > -I/home/plunky/src/lib/libbsdmalloc/../libc/include/  -c    -fPIC -DPIC 
> > malloc.c -o malloc.pico
> > objcopy -x malloc.pico
> > #   compile  libbsdmalloc/malloc.po
> > pcc -O2 -std=gnu99  -Wall -Wstrict-prototypes -Wmissing-prototypes 
> > -Wpointer-arith -Wno-sign-compare  -Wno-traditional  -Wa,--fatal-warnings 
> > -Wreturn-type -Wswitch -Wshadow -Werror     -D_REENT -D_REENTRANT 
> > -I/home/plunky/src/lib/libbsdmalloc/../libc/include/  -c -DGPROF -DPROF    
> > -pg malloc.c -o malloc.po
> > objcopy -X malloc.po
> > #     build  libbsdmalloc/libbsdmalloc.a
> > rm -f libbsdmalloc.a
> > ar crs libbsdmalloc.a `NM=nm lorder malloc.o | tsort -q`
> > #     build  libbsdmalloc/libbsdmalloc_p.a
> > rm -f libbsdmalloc_p.a
> > ar crs libbsdmalloc_p.a `NM=nm lorder malloc.po | tsort -q`
> > #     build  libbsdmalloc/libbsdmalloc_pic.a
> > rm -f libbsdmalloc_pic.a
> > ar crs libbsdmalloc_pic.a `NM=nm lorder malloc.pico | tsort -q`
> > #     build  libbsdmalloc/libbsdmalloc.so.0.0
> > rm -f libbsdmalloc.so.0.0
> > pcc  -Wl,-x -shared -Wl,-soname,libbsdmalloc.so.0 -Wl,--warn-shared-textrel 
> >    -o libbsdmalloc.so.0.0  -Wl,-rpath-link,/lib  -L=/lib  
> > -Wl,--whole-archive libbsdmalloc_pic.a -Wl,--no-whole-archive
> > ln -sf libbsdmalloc.so.0.0 libbsdmalloc.so.0.tmp
> > mv -f libbsdmalloc.so.0.tmp libbsdmalloc.so.0
> > ln -sf libbsdmalloc.so.0.0 libbsdmalloc.so.tmp
> > mv -f libbsdmalloc.so.tmp libbsdmalloc.so
> > 
> > 
> > 
> > 
> > % make HAVE_PCC= MKLINT=no MKMAN=no
> > #   compile  libbsdmalloc/malloc.o
> > /usr/tools/bin/i486--netbsdelf-pcc -O2 -std=gnu99  -Wall 
> > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  
> > -Wno-traditional  -Wa,--fatal-warnings -Wreturn-type -Wswitch -Wshadow 
> > -Werror     --sysroot=/ -D_REENT -D_REENTRANT 
> > -I/home/plunky/src/lib/libbsdmalloc/../libc/include/  -c    malloc.c -o 
> > malloc.o
> > /usr/tools/bin/i486--netbsdelf-objcopy -x malloc.o
> > #   compile  libbsdmalloc/malloc.pico
> > /usr/tools/bin/i486--netbsdelf-pcc -O2 -std=gnu99  -Wall 
> > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  
> > -Wno-traditional  -Wa,--fatal-warnings -Wreturn-type -Wswitch -Wshadow 
> > -Werror     --sysroot=/ -D_REENT -D_REENTRANT 
> > -I/home/plunky/src/lib/libbsdmalloc/../libc/include/  -c    -fPIC -DPIC 
> > malloc.c -o malloc.pico
> > /usr/tools/bin/i486--netbsdelf-objcopy -x malloc.pico
> > #   compile  libbsdmalloc/malloc.po
> > /usr/tools/bin/i486--netbsdelf-pcc -O2 -std=gnu99  -Wall 
> > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  
> > -Wno-traditional  -Wa,--fatal-warnings -Wreturn-type -Wswitch -Wshadow 
> > -Werror     --sysroot=/ -D_REENT -D_REENTRANT 
> > -I/home/plunky/src/lib/libbsdmalloc/../libc/include/  -c -DGPROF -DPROF    
> > -pg malloc.c -o malloc.po
> > /usr/tools/bin/i486--netbsdelf-objcopy -X malloc.po
> > #     build  libbsdmalloc/libbsdmalloc.a
> > rm -f libbsdmalloc.a
> > /usr/tools/bin/i486--netbsdelf-ar crs libbsdmalloc.a 
> > `NM=/usr/tools/bin/i486--netbsdelf-nm NM=/usr/tools/bin/i486--netbsdelf-nm 
> > MKTEMP=/usr/tools/bin/nbmktemp /usr/tools/bin/nblorder malloc.o | 
> > /usr/tools/bin/nbtsort -q`
> > #     build  libbsdmalloc/libbsdmalloc_p.a
> > rm -f libbsdmalloc_p.a
> > /usr/tools/bin/i486--netbsdelf-ar crs libbsdmalloc_p.a 
> > `NM=/usr/tools/bin/i486--netbsdelf-nm NM=/usr/tools/bin/i486--netbsdelf-nm 
> > MKTEMP=/usr/tools/bin/nbmktemp /usr/tools/bin/nblorder malloc.po | 
> > /usr/tools/bin/nbtsort -q`
> > #     build  libbsdmalloc/libbsdmalloc_pic.a
> > rm -f libbsdmalloc_pic.a
> > /usr/tools/bin/i486--netbsdelf-ar crs libbsdmalloc_pic.a 
> > `NM=/usr/tools/bin/i486--netbsdelf-nm NM=/usr/tools/bin/i486--netbsdelf-nm 
> > MKTEMP=/usr/tools/bin/nbmktemp /usr/tools/bin/nblorder malloc.pico | 
> > /usr/tools/bin/nbtsort -q`
> > #     build  libbsdmalloc/libbsdmalloc.so.0.0
> > rm -f libbsdmalloc.so.0.0
> > /usr/tools/bin/i486--netbsdelf-pcc  -Wl,-x -shared 
> > -Wl,-soname,libbsdmalloc.so.0 -Wl,--warn-shared-textrel  --sysroot=/   -o 
> > libbsdmalloc.so.0.0  -Wl,-rpath-link,/lib  -L=/lib  -Wl,--whole-archive 
> > libbsdmalloc_pic.a -Wl,--no-whole-archive
> > ln -sf libbsdmalloc.so.0.0 libbsdmalloc.so.0.tmp
> > mv -f libbsdmalloc.so.0.tmp libbsdmalloc.so.0
> > ln -sf libbsdmalloc.so.0.0 libbsdmalloc.so.tmp
> > mv -f libbsdmalloc.so.tmp libbsdmalloc.so
> 
> -- 
> Brad Harder
> Method Logic Digital Consulting
> http://methodlogic.net/
> http://twitter.com/bcharder
> 

-- 
Brad Harder
Method Logic Digital Consulting
http://methodlogic.net/
http://twitter.com/bcharder



Home | Main Index | Thread Index | Old Index