[OpenAFS-devel] OpenAFS on FreeBSD 6.1-BETA (lwp and -fPIC problems)
David G. Andersen
dga+@cs.cmu.edu
Sat, 18 Feb 2006 13:00:38 -0500
I spent a bit of time trying to get the latest OpenAFS from CVS
to work under FreeBSD 6.1, and I've hit a small wall in the
amd64 process.s code in lwp. A suggested fix from someone who
knows amd64 better than I would be welcome.
Changes required to get it to work this far:
- The previously mentioned -mpreferred-stack-boundary=2 problem
https://www.openafs.org/pipermail/openafs-info/2006-January/020946.html
(but also added -fPIC to the MakefileProto.FBSD.in)
- Created a param file and new SYS_NAME_ID in much the same way the
above poster did:
#define SYS_NAME_ID_amd64_fbsd_60 3009
#define SYS_NAME_ID_amd64_fbsd_61 3010
- Created a new amd64_fbsd_* subsection in osconf.m4 and
added -fPIC to the CCOBJ and SHLIB_CFLAGS lines
And then hit the remaining problem: When bundling liblwp.a into a
shared library, I get the error:
/usr/bin/ld: process.o: relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC
This comes from process.amd64.s. The first problem in this file is the
references to the external PRE_Block variable:
movl $1,_C_LABEL(PRE_Block) /* Do not allow any interrupts */
and
movl $0,_C_LABEL(PRE_Block) /* clear it up... */
But this is where I've hit the end of what I know about amd64. I
tried replacing these with GOT-relative references:
movq PRE_Block@GOTPCREL(%rip), %rax
movl $1,(%rax) /* Do not allow any interrupts */
(moving the save of %rax appropriately). This makes the file compile,
but then FreeBSD complains when I try to load the resulting module:
Feb 18 02:28:16 moo kernel: kldload: Unsupported file type
Feb 18 02:28:16 moo kernel: kldload: unexpected relocation type 7
Feb 18 02:28:16 moo kernel: link_elf: symbol copyinstr undefined
Clue or patch would be very welcome at this point. I've kind of run
out of time to sink into getting it running.
-Dave