Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build on FreeBSD PowerPC64 #69

Closed
ghost opened this issue Jul 19, 2019 · 25 comments · Fixed by #97
Closed

Fails to build on FreeBSD PowerPC64 #69

ghost opened this issue Jul 19, 2019 · 25 comments · Fixed by #97

Comments

@ghost
Copy link

ghost commented Jul 19, 2019

Hi, sysutils/lsof fails to build on FreeBSD / PowerPC64 with the following error:

cc -o lsof -pipe -fstack-protector-strong -fno-strict-aliasing -DNEEDS_BOOL_TYPEDEF -DHASTASKS -DHAS_PAUSE_SBT -DHAS_DUP2 -DHAS_CLOSEFROM -DHASEFFNLINK=i_effnlink -DHASF_VNODE -DHAS_FILEDESCENT -DHAS_TMPFS -DHASWCTYPE_H -DHASSBSTATE -DHAS_KVM_VNODE -DHAS_UFS1_2 -DHAS_NO_IDEV -DHAS_VM_MEMATTR_T -DNEEDS_DEVICE_T -DHAS_CDEV2PRIV -DHAS_NO_SI_UDEV -DHAS_SYS_SX_H -DHASFUSEFS -DHAS_ZFS -DHAS_V_LOCKF -DHAS_LOCKF_ENTRY -DHAS_NO_6PORT -DHAS_NO_6PPCB -DNEEDS_BOOLEAN_T -DHAS_SB_CCC -DHAS_FDESCENTTBL -DFREEBSDV=13000 -DHASFDESCFS=2 -DHASPSEUDOFS -DHASNULLFS -DHASIPv6 -DHASUTMPX -DHAS_STRFTIME -DLSOF_VSTR="13.0-CURRENT" -I/usr/src/sys -O2 dmnt.o dnode.o dnode1.o dnode2.o dproc.o dsock.o dstore.o arg.o main.o misc.o node.o print.o proc.o store.o usage.o util.o -L./lib -llsof -lkvm
dnode2.o:(.text+0x190): undefined reference to abd_zero_off' dnode2.o:(.text+0x1c8): undefined reference to abd_cmp_buf_off'
dnode2.o:(.text+0x200): undefined reference to abd_copy_to_buf_off' dnode2.o:(.text+0x238): undefined reference to abd_copy_from_buf_off'
dnode2.o:(.text+0x274): undefined reference to `abd_copy_off'
*** Error code 1

Stop.
make[1]: stopped in /wrkdirs/usr/ports/sysutils/lsof/work/lsof-4.93.2
*** Error code 1

Stop.
make: stopped in /usr/ports/sysutils/lsof

This is from: http://pylon.nyi.freebsd.org/data/head-powerpc64-default/p506720_s350020/logs/errors/lsof-4.93.2_2,8.log

There is a mention of some one getting it to pass by adding -lzpool in the email posting: http://freebsd.1045724.x6.nabble.com/lsof-doesn-t-compile-on-my-ppc64-td6294887.html

Regards

@lrosenman
Copy link
Contributor

I'll ask the PPC guys. Is ZFS supported on PPC64? If not, we (lsof) need to detect that.

(I'm the FreeBSD maintainer for sysutils/lsof).

I'm AKA [email protected]

@ghost
Copy link
Author

ghost commented Jul 24, 2019

I think ZFS is supported on ppc64, I am not using it as my fs, but looks like the kernel module is loaded:

root@PowerMacG5:~ # kldload zfs
kldload: can't load zfs: module already loaded or in kernel

@lrosenman
Copy link
Contributor

I pinged Mark Linimon [email protected] and apparently, it's been broken for a long time. I don't have PPC* hardware to test on. Patches welcome.

@masatake
Copy link
Contributor

As far as reading dnode2.c, abd_* are not referred directly.
We need a disassembled result of dnode2.o.

make clean
vi lsof/Makefile
Set -g to DEBUG= instead of -O.
make

Then you will get dnode2.o with symbol information.
Then run objdump -d -S -l dnode2.o (or something similar if no GNU tool is installed).

I would like to see the output of the objdump.

@ghost
Copy link
Author

ghost commented Jul 25, 2019

Hi, I'm currently getting another error, I'm running FreeBSD Current:

(cd lib; make DEBUG="-g" CFGF="-pipe -DNEEDS_BOOL_TYPEDEF -DHASTASKS -DHAS_PAUSE_SBT -DHAS_DUP2 -DHAS_CLOSEFROM -DHASEFFNLINK=i_effnlink -DHASF_VNODE -DHAS_FILEDESCENT -DHAS_TMPFS -DHASWCTYPE_H -DHASSBSTATE -DHAS_KVM_VNODE -DHAS_UFS1_2 -DHAS_NO_IDEV -DHAS_VM_MEMATTR_T -DNEEDS_DEVICE_T -DHAS_CDEV2PRIV -DHAS_NO_SI_UDEV -DHAS_SYS_SX_H -DHASFUSEFS -DHAS_ZFS -DHAS_V_LOCKF -DHAS_LOCKF_ENTRY -DHAS_NO_6PORT -DHAS_NO_6PPCB -DNEEDS_BOOLEAN_T -DHAS_SB_CCC -DHAS_FDESCENTTBL -DFREEBSDV=13000 -DHASFDESCFS=2 -DHASPSEUDOFS -DHASNULLFS -DHASIPv6 -DHASUTMPX -DHAS_STRFTIME -DLSOF_VSTR="13.0-CURRENT"")
cc -pipe -DNEEDS_BOOL_TYPEDEF -DHASTASKS -DHAS_PAUSE_SBT -DHAS_DUP2 -DHAS_CLOSEFROM -DHASEFFNLINK=i_effnlink -DHASF_VNODE -DHAS_FILEDESCENT -DHAS_TMPFS -DHASWCTYPE_H -DHASSBSTATE -DHAS_KVM_VNODE -DHAS_UFS1_2 -DHAS_NO_IDEV -DHAS_VM_MEMATTR_T -DNEEDS_DEVICE_T -DHAS_CDEV2PRIV -DHAS_NO_SI_UDEV -DHAS_SYS_SX_H -DHASFUSEFS -DHAS_ZFS -DHAS_V_LOCKF -DHAS_LOCKF_ENTRY -DHAS_NO_6PORT -DHAS_NO_6PPCB -DNEEDS_BOOLEAN_T -DHAS_SB_CCC -DHAS_FDESCENTTBL -DFREEBSDV=13000 -DHASFDESCFS=2 -DHASPSEUDOFS -DHASNULLFS -DHASIPv6 -DHASUTMPX -DHAS_STRFTIME -DLSOF_VSTR="13.0-CURRENT" -I/usr/src/sys -g -c ckkv.c -o ckkv.o
In file included from /usr/src/sys/sys/file.h:44,
from ../dlsof.h:406,
from ../lsof.h:250,
from ckkv.c:42:
/usr/src/sys/sys/refcount.h: In function 'refcount_acquire_checked':
/usr/src/sys/sys/refcount.h:65: error: 'false' undeclared (first use in this function)
/usr/src/sys/sys/refcount.h:65: error: (Each undeclared identifier is reported only once
/usr/src/sys/sys/refcount.h:65: error: for each function it appears in.)
/usr/src/sys/sys/refcount.h:68: error: 'true' undeclared (first use in this function)
/usr/src/sys/sys/refcount.h: In function 'refcount_release':
/usr/src/sys/sys/refcount.h:81: error: 'false' undeclared (first use in this function)
/usr/src/sys/sys/refcount.h:90: error: 'true' undeclared (first use in this function)
/usr/src/sys/sys/refcount.h: In function 'refcount_acquire_if_not_zero':
/usr/src/sys/sys/refcount.h:106: error: 'false' undeclared (first use in this function)
/usr/src/sys/sys/refcount.h:108: error: 'true' undeclared (first use in this function)
/usr/src/sys/sys/refcount.h: In function 'refcount_release_if_not_last':
/usr/src/sys/sys/refcount.h:121: error: 'false' undeclared (first use in this function)
/usr/src/sys/sys/refcount.h:123: error: 'true' undeclared (first use in this function)
*** Error code 1

Stop.
make[1]: stopped in /root/testing/lsof/lib
*** Error code 1

@ghost
Copy link
Author

ghost commented Jul 26, 2019

Hi, so checking out https://github.com/lrosenman/lsof/tree/fix-refcount gets me back to this:

cc -o lsof -pipe -DNEEDS_BOOL_TYPEDEF -DHASTASKS -DHAS_PAUSE_SBT -DHAS_DUP2 -DHAS_CLOSEFROM -DHASEFFNLINK=i_effnlink -DHASF_VNODE -DHAS_FILEDESCENT -DHAS_TMPFS -DHASWCTYPE_H -DHASSBSTATE -DHAS_KVM_VNODE -DHAS_UFS1_2 -DHAS_NO_IDEV -DHAS_VM_MEMATTR_T -DNEEDS_DEVICE_T -DHAS_CDEV2PRIV -DHAS_NO_SI_UDEV -DHAS_SYS_SX_H -DHASFUSEFS -DHAS_ZFS -DHAS_V_LOCKF -DHAS_LOCKF_ENTRY -DHAS_NO_6PORT -DHAS_NO_6PPCB -DNEEDS_BOOLEAN_T -DHAS_SB_CCC -DHAS_FDESCENTTBL -DFREEBSDV=13000 -DHASFDESCFS=2 -DHASPSEUDOFS -DHASNULLFS -DHASIPv6 -DHASUTMPX -DHAS_STRFTIME -DLSOF_VSTR="13.0-CURRENT" -I/usr/src/sys -O2 dmnt.o dnode.o dnode1.o dnode2.o dproc.o dsock.o dstore.o arg.o main.o misc.o node.o print.o proc.o store.o usage.o util.o -L./lib -llsof -lkvm
dnode2.o:(.text+0x170): undefined reference to abd_zero_off' dnode2.o:(.text+0x1a8): undefined reference to abd_cmp_buf_off'
dnode2.o:(.text+0x1e0): undefined reference to abd_copy_to_buf_off' dnode2.o:(.text+0x218): undefined reference to abd_copy_from_buf_off'
dnode2.o:(.text+0x254): undefined reference to `abd_copy_off'
*** Error code 1

running: objdump -d -S -l dnode2.o

dnode2.o: file format elf64-powerpc-freebsd

88: 38 a0 01 10 li r5,272
8c: 48 00 00 01 bl 8c <.readzfsnode+0x48>
90: 4f ff fb 82 crmove 4cr7+so,4cr7+so
94: 2f a3 00 00 cmpdi cr7,r3,0
98: 41 9e 00 20 beq- cr7,b8 <.readzfsnode+0x74>
9c: 38 21 11 30 addi r1,r1,4400
a0: e8 62 00 08 ld r3,8(r2)
a4: e8 01 00 10 ld r0,16(r1)
a8: eb c1 ff f0 ld r30,-16(r1)
ac: 7c 08 03 a6 mtlr r0
b0: eb e1 ff f8 ld r31,-8(r1)
b4: 4e 80 00 20 blr
b8: 2f bf 00 00 cmpdi cr7,r31,0
bc: e8 01 00 80 ld r0,128(r1)
c0: e9 61 01 10 ld r11,272(r1)
c4: 39 20 00 01 li r9,1
c8: f8 1e 00 00 std r0,0(r30)
cc: 99 3e 00 28 stb r9,40(r30)
d0: f9 7e 00 10 std r11,16(r30)
d4: 41 9e 00 10 beq- cr7,e4 <.readzfsnode+0xa0>
d8: e8 61 00 70 ld r3,112(r1)
dc: 2f a3 00 00 cmpdi cr7,r3,0
e0: 40 9e 00

000000000000015c <.abd_zero>:
15c: 7c 08 02 a6 mflr r0
160: 7c 85 23 78 mr r5,r4
164: 38 80 00 00 li r4,0
168: f8 01 00 10 std r0,16(r1)
16c: f8 21 ff 91 stdu r1,-112(r1)
170: 48 00 00 01 bl 170 <.abd_zero+0x14>
174: 4f ff fb 82 crmove 4cr7+so,4cr7+so
178: 38 21 00 70 addi r1,r1,112
17c: e8 01 00 10 ld r0,16(r1)
180: 7c 08 03 a6 mtlr r0
184: 4e 80 00 20 blr
188: 00 00 00 00 .long 0x0
18c: 00 00 00 01 .long 0x1
190: 80 00 00 00 lwz r0,0(0)

0000000000000194 <.abd_cmp_buf>:
194: 7c 08 02 a6 mflr r0
198: 7c a6 2b 78 mr r6,r5
19c: 38 a0 00 00 li r5,0
1a0: f8 01 00 10 std r0,16(r1)
1a4:
20c: 38 a0 00 00 li r5,0
210: f8 01 00 10 std r0,16(r1)
214: f8 21 ff 91 stdu r1,-112(r1)
218: 48 00 00 01 bl 218 <.abd_copy_from_buf+0x14>
21c: 4f ff fb 82 crmove 4cr7+so,4cr7+so
220: 38 21 00 70 addi r1,r1,112
224: e8 01 00 10 ld r0,16(r1)
228: 7c 08 03 a6 mtlr r0
22c: 4e 80 00 20 blr
230: 00 00 00 00 .long 0x0
234: 00 00 00 01 .long 0x1
238: 80 00 00 00 lwz r0,0(0)

000000000000023c <.abd_copy>:
23c: 7c 08 02 a6 mflr r0
240: 7c a7 2b 78 mr r7,r5
244: 38 c0 00 00 li r6,0
248: f8 01 00 10 std r0,16(r1)
24c: 38 a0 00 00 li r5,0
250: f8 21 ff 91 stdu r1,-112(r1)
254: 48 00 00 01 bl 254 <.abd_copy+0x18>
258: 4f ff fb 82 crmove 4cr7+so,4cr7+so
25c: 38 21 00 70 addi r1,r1,112
260: e8 01 00 10 ld r0,16(r1)
264: 7c 08 03 a6 mtlr r0
268: 4e 80 00 20 blr
26c: 00 00 00 00 .long 0x0
270: 00 00 00 01 .long 0x1
274: 80 00 00 00 lwz r0,0(0)

@ghost
Copy link
Author

ghost commented Jul 26, 2019

in the Makefile, if change:

CFGL= -L./lib -llsof -lkvm

to

CFGL= -L./lib -llsof -lkvm -lzpool

it compiles without errors.

@lrosenman
Copy link
Contributor

I wonder why ppc* needs -lzpool and none of the other FreeBSD dialects do?

@masatake
Copy link
Contributor

@TheXCoder

dnode2.o: file format elf64-powerpc-freebsd

88: 38 a0 01 10 li r5,272

Don't you omit some lines between above two lines?
The line must start from 0 like:

[yamato@freebsd ~/lsof-legacy]$ objdump -d dnode2.o

dnode2.o:     file format elf64-x86-64-freebsd

Disassembly of section .text:

0000000000000000 <readzfsnode>:
   0:	55                   	push   %rbp
   1:	48 89 e5             	mov    %rsp,%rbp
   4:	41 57                	push   %r15
   6:	41 56                	push   %r14
...

@ghost
Copy link
Author

ghost commented Jul 28, 2019

Hi, sorry, was copy / paste from a terminal window must have missed it, here is the full objdump without adding -lzpool to the Makefile, and with DEBUG = g

dnode2.o: file format elf64-powerpc-freebsd

Disassembly of section .text:

0000000000000000 <.abd_is_linear>:
0: 80 63 00 00 lwz r3,0(r3)
4: 78 63 07 e0 clrldi r3,r3,63
8: 4e 80 00 20 blr
...

0000000000000018 <.dmu_buf_init_user>:
18: f8 a3 00 38 std r5,56(r3)
1c: f8 83 00 30 std r4,48(r3)
20: 4e 80 00 20 blr
...

0000000000000030 <._cv_timedwait_sbt>:
30: 38 60 00 00 li r3,0
34: 4e 80 00 20 blr
...

0000000000000044 <.readzfsnode>:
44: 2f a3 00 00 cmpdi cr7,r3,0
48: 7c 08 02 a6 mflr r0
4c: fb c1 ff f0 std r30,-16(r1)
50: 7c 9e 23 78 mr r30,r4
54: fb e1 ff f8 std r31,-8(r1)
58: 7c bf 2b 78 mr r31,r5
5c: f8 01 00 10 std r0,16(r1)
60: f8 21 ee d1 stdu r1,-4400(r1)
64: 40 9e 00 20 bne- cr7,84 <.readzfsnode+0x40>
68: e8 62 00 00 ld r3,0(r2)
6c: 38 21 11 30 addi r1,r1,4400
70: e8 01 00 10 ld r0,16(r1)
74: eb c1 ff f0 ld r30,-16(r1)
78: 7c 08 03 a6 mtlr r0
7c: eb e1 ff f8 ld r31,-8(r1)
80: 4e 80 00 20 blr
84: 38 81 00 70 addi r4,r1,112
88: 38 a0 01 10 li r5,272
8c: 48 00 00 01 bl 8c <.readzfsnode+0x48>
90: 4f ff fb 82 crmove 4cr7+so,4cr7+so
94: 2f a3 00 00 cmpdi cr7,r3,0
98: 41 9e 00 20 beq- cr7,b8 <.readzfsnode+0x74>
9c: 38 21 11 30 addi r1,r1,4400
a0: e8 62 00 08 ld r3,8(r2)
a4: e8 01 00 10 ld r0,16(r1)
a8: eb c1 ff f0 ld r30,-16(r1)
ac: 7c 08 03 a6 mtlr r0
b0: eb e1 ff f8 ld r31,-8(r1)
b4: 4e 80 00 20 blr
b8: 2f bf 00 00 cmpdi cr7,r31,0
bc: e8 01 00 80 ld r0,128(r1)
c0: e9 61 01 10 ld r11,272(r1)
c4: 39 20 00 01 li r9,1
c8: f8 1e 00 00 std r0,0(r30)
cc: 99 3e 00 28 stb r9,40(r30)
d0: f9 7e 00 10 std r11,16(r30)
d4: 41 9e 00 10 beq- cr7,e4 <.readzfsnode+0xa0>
d8: e8 61 00 70 ld r3,112(r1)
dc: 2f a3 00 00 cmpdi cr7,r3,0
e0: 40 9e 00 20 bne- cr7,100 <.readzfsnode+0xbc>
e4: e9 21 00 f8 ld r9,248(r1)
e8: 38 00 00 01 li r0,1
ec: 38 60 00 00 li r3,0
f0: 98 1e 00 29 stb r0,41(r30)
f4: f9 3e 00 20 std r9,32(r30)
f8: 98 1e 00 2b stb r0,43(r30)
fc: 4b ff ff 70 b 6c <.readzfsnode+0x28>
100: 38 81 01 80 addi r4,r1,384
104: 38 a0 0f 98 li r5,3992
108: 48 00 00 01 bl 108 <.readzfsnode+0xc4>
10c: 4f ff fb 82 crmove 4cr7+so,4cr7+so
110: 2f a3 00 00 cmpdi cr7,r3,0
114: 40 be ff d0 bne- cr7,e4 <.readzfsnode+0xa0>
118: e8 01 00 80 ld r0,128(r1)
11c: e9 21 01 98 ld r9,408(r1)
120: 7f a0 48 00 cmpd cr7,r0,r9
124: 40 9e ff c0 bne+ cr7,e4 <.readzfsnode+0xa0>
128: e8 01 08 80 ld r0,2176(r1)
12c: 2f a0 00 00 cmpdi cr7,r0,0
130: 41 be ff b4 beq- cr7,e4 <.readzfsnode+0xa0>
134: 80 01 08 88 lwz r0,2184(r1)
138: 2f 80 00 00 cmpwi cr7,r0,0
13c: 41 be ff a8 beq- cr7,e4 <.readzfsnode+0xa0>
140: e9 3e 00 10 ld r9,16(r30)
144: 39 29 00 01 addi r9,r9,1
148: f9 3e 00 10 std r9,16(r30)
14c: 4b ff ff 98 b e4 <.readzfsnode+0xa0>
150: 00 00 00 00 .long 0x0
154: 00 00 00 01 .long 0x1
158: 80 02 00 00 lwz r0,0(r2)

000000000000015c <.abd_zero>:
15c: 7c 08 02 a6 mflr r0
160: 7c 85 23 78 mr r5,r4
164: 38 80 00 00 li r4,0
168: f8 01 00 10 std r0,16(r1)
16c: f8 21 ff 91 stdu r1,-112(r1)
170: 48 00 00 01 bl 170 <.abd_zero+0x14>
174: 4f ff fb 82 crmove 4cr7+so,4cr7+so
178: 38 21 00 70 addi r1,r1,112
17c: e8 01 00 10 ld r0,16(r1)
180: 7c 08 03 a6 mtlr r0
184: 4e 80 00 20 blr
188: 00 00 00 00 .long 0x0
18c: 00 00 00 01 .long 0x1
190: 80 00 00 00 lwz r0,0(0)

0000000000000194 <.abd_cmp_buf>:
194: 7c 08 02 a6 mflr r0
198: 7c a6 2b 78 mr r6,r5
19c: 38 a0 00 00 li r5,0
1a0: f8 01 00 10 std r0,16(r1)
1a4: f8 21 ff 91 stdu r1,-112(r1)
1a8: 48 00 00 01 bl 1a8 <.abd_cmp_buf+0x14>
1ac: 4f ff fb 82 crmove 4cr7+so,4cr7+so
1b0: 38 21 00 70 addi r1,r1,112
1b4: e8 01 00 10 ld r0,16(r1)
1b8: 7c 08 03 a6 mtlr r0
1bc: 4e 80 00 20 blr
1c0: 00 00 00 00 .long 0x0
1c4: 00 00 00 01 .long 0x1
1c8: 80 00 00 00 lwz r0,0(0)

00000000000001cc <.abd_copy_to_buf>:
1cc: 7c 08 02 a6 mflr r0
1d0: 7c a6 2b 78 mr r6,r5
1d4: 38 a0 00 00 li r5,0
1d8: f8 01 00 10 std r0,16(r1)
1dc: f8 21 ff 91 stdu r1,-112(r1)
1e0: 48 00 00 01 bl 1e0 <.abd_copy_to_buf+0x14>
1e4: 4f ff fb 82 crmove 4cr7+so,4cr7+so
1e8: 38 21 00 70 addi r1,r1,112
1ec: e8 01 00 10 ld r0,16(r1)
1f0: 7c 08 03 a6 mtlr r0
1f4: 4e 80 00 20 blr
1f8: 00 00 00 00 .long 0x0
1fc: 00 00 00 01 .long 0x1
200: 80 00 00 00 lwz r0,0(0)

0000000000000204 <.abd_copy_from_buf>:
204: 7c 08 02 a6 mflr r0
208: 7c a6 2b 78 mr r6,r5
20c: 38 a0 00 00 li r5,0
210: f8 01 00 10 std r0,16(r1)
214: f8 21 ff 91 stdu r1,-112(r1)
218: 48 00 00 01 bl 218 <.abd_copy_from_buf+0x14>
21c: 4f ff fb 82 crmove 4cr7+so,4cr7+so
220: 38 21 00 70 addi r1,r1,112
224: e8 01 00 10 ld r0,16(r1)
228: 7c 08 03 a6 mtlr r0
22c: 4e 80 00 20 blr
230: 00 00 00 00 .long 0x0
234: 00 00 00 01 .long 0x1
238: 80 00 00 00 lwz r0,0(0)

000000000000023c <.abd_copy>:
23c: 7c 08 02 a6 mflr r0
240: 7c a7 2b 78 mr r7,r5
244: 38 c0 00 00 li r6,0
248: f8 01 00 10 std r0,16(r1)
24c: 38 a0 00 00 li r5,0
250: f8 21 ff 91 stdu r1,-112(r1)
254: 48 00 00 01 bl 254 <.abd_copy+0x18>
258: 4f ff fb 82 crmove 4cr7+so,4cr7+so
25c: 38 21 00 70 addi r1,r1,112
260: e8 01 00 10 ld r0,16(r1)
264: 7c 08 03 a6 mtlr r0
268: 4e 80 00 20 blr
26c: 00 00 00 00 .long 0x0
270: 00 00 00 01 .long 0x1
274: 80 00 00 00 lwz r0,0(0)

@ghost
Copy link
Author

ghost commented Jul 29, 2019

Hi, not the cleanest solution, but adding something like this gets it building again!

--- a/Configure
+++ b/Configure
@@ -1733,6 +1733,15 @@ kernel generation process.

 # Do FreeBSD version-specific stuff.

+#Fix FreeBSD PowerPC build

  • LSOF_TMP1=uname -m
  • if test "$LSOF_TMP1" = "powerpc"
  • then
  •    LSOF_CFGL="$LSOF_CFGL -lzpool"
    
  • fi
  • case $LSOF_VERS in # {
    1000)
    LSOF_CFGF="$LSOF_CFGF -DHASPROCFS"

@masatake
Copy link
Contributor

Thank you. But I would like to know what happens behind the scene more.
Just for running lsof on PowerPC now, your fix is enough.
However, it is not enough for mainlining lsof for next years.

I would like to see the output of execution of two command lines without OMITTING lines.

  • (preparation) $ make clean
    1. make
      (I would like to know what kind of options are passed to C comppiler.)
    1. objdump -d -S -l dnode2.o
      (without omitting lines)

The output will be long. So, please paste them to your gist or send them to "[email protected]".
(Pasting here is also o.k.)

You may know C language. So I would like to hear your comment.
The biggest question is why abd_* are defined in dnode2.o.
As far as reading dnode2.c, only two functions are defined: readzfsnode and _cv_timedwait_sbt.

@ghost
Copy link
Author

ghost commented Jul 30, 2019

Hi, do you want the outputs with the debug -g set in the Makefile?

@masatake
Copy link
Contributor

Yes, please add -g to DEBUG of Makefile. Removing -O from DEBUG is better.

If possible, I would like to put your lsof source tree after building somewhere I can get download.

@masatake
Copy link
Contributor

@TheXCoder, thank you, I received the output.

Now I understand where adb_* functions come from.

They come from sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h.
For an example,

inline void
abd_copy(abd_t *dabd, abd_t *sabd, size_t size)
{
	abd_copy_off(dabd, sabd, 0, 0, size);
}

They are inline functions. Though abd_ functions are not included in dnode2.c, the inline functions are replaced in dnode2.c. abd_copy is o.k. It is expaned inline in dnode2.c. How about adb_copy_off called from abd_copy? It is declared in abd.h. However, it is not an inline function.
As the result dnode2.o gets having unresolved symbol entry. The symbol, abd_copy_off may be defined in libzpool.so. As the result, lsof now needs to be linked with libzpool.

Why does this happen only PowerPC?
I guess something to do with compiler. A compiler on x86_64 may not expand inline unused inline functions in dnode2.o. So dnode2.o doesn't have the unresolved symbol entry. On the other hand, the compiler on PowerPC may expand inline the inline functions even they are not used in dnode2.c.

I'm running freebsd 11.2-released r3355510 on kvm of linux.

adb_copy in sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h on r3355510 has inline modifier, too. However, the output of objdump for dnode2.o on the platform doesn't include the definition of abd_copy. It is not expand inline.

I will study more the impact of "inline" modifier on x86_64 FreeBSD.

Linking libzpool.so to lsof, the solution you proposed, is acceptable. Another one is specifying "don't expand inline unused function" option to compilers.

I have no time more for now. I will report again when I get progress.

@masatake
Copy link
Contributor

BTW, you didn't any lines. I misunderstood "..." in objdump output. I'm sorry about my wrong suspecting.

@masatake
Copy link
Contributor

masatake commented Jun 4, 2020

I joined the discussion, and I wanted to study FreeBSD. However, I find I don't have enough time to do so. I will not work this topic anymore.

@lrosenman
Copy link
Contributor

I have patches in the FreeBSD port that I will work on getting into our (lsof-org) master.

@masatake what's the process for requesting/making a release for a particular dialect (or all if that's necessary)?

@masatake
Copy link
Contributor

masatake commented Jun 5, 2020

Does "making a release for a particular dialect" mean "making a tarball including only the particular dialect?

@lrosenman
Copy link
Contributor

Yes. Making a tar / tag that can pull just FreeBSD for example. Or what's the process for me to ask for a release tag?

@masatake
Copy link
Contributor

masatake commented Jun 5, 2020

Do you have strong reason to make a tarball for the specified dialect?
(Just a question)

I myself want to make a taball for linux. See my reason #89.
However, I don't know the way to make a tarball for the specified dialect.

@lrosenman
Copy link
Contributor

Just a way to get a FreeBSD "fixup" release like Vic used to do between releases here.

I.E. so I can update the port and lose some of the patches after I merge them.

@masatake
Copy link
Contributor

masatake commented Jun 5, 2020

I should change the question.
If a tarball of a new release includes all dialects, do you have any trouble on FreeBSD.

My idea of the process for releasing is that just making a release if one of us wants.
If one wants to make a release, open an issue like #96 .

In such a isse, we can agree:

  • the version number,
  • todo items we should/want to fix,
  • checking 00CREDITS, and so on.

The tarball should be made the person who such a issue.
The actuall procedures for making a tarball and uploadint it should be documented.

@lrosenman
Copy link
Contributor

I'm fine with it including ALL dialects. I just need to know what the process is, and what interlocks there are between all of us for making a release from master.

@masatake
Copy link
Contributor

masatake commented Jun 5, 2020

I see. Let's continue the discussion at #96.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants