Page MenuHomeFreeBSD

[openzfs] Fix compilation under gcc for freebsd
Needs RevisionPublic

Authored by adrian on Oct 15 2020, 4:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 28 2023, 5:31 PM
Unknown Object (File)
Dec 20 2023, 7:14 AM
Unknown Object (File)
Jun 10 2023, 9:10 PM
Unknown Object (File)
May 30 2023, 3:35 AM
Unknown Object (File)
Apr 26 2023, 3:59 AM
Unknown Object (File)
Apr 22 2023, 10:56 AM
Unknown Object (File)
Apr 8 2023, 10:25 AM
Subscribers

Details

Reviewers
imp
Summary
  • Fix some "pointers are uint64_t's" errors
  • actually implement the printf0 bits that we do on freebsd customised gcc compilers, to include the kernel specific extensions we have.

The second one was more fun - it's plainly a copy from
illumnos and assumes illumnos compiler extensions which
we obviously don't have. It's not triggered on llvm
because it was conditioned on gcc.

Test Plan
  • compiled on gcc-6.4 amd64

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 34181
Build 31334: arc lint + arc unit

Event Timeline

imp requested changes to this revision.Oct 15 2020, 10:04 AM
imp added inline comments.
sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
63

Better to just kill the ifdef entirely and the #else. There's 0 chance ZFS will run on anything < 10, let alone 3, so this #if is always going to be true.

67

This is a rather large semantic change to go from cmn_errr -> printf0 directly.
Why is this needed?

sys/contrib/openzfs/module/zfs/spa.c
1388

Why his this crazy uintptr_t needed? I think we'd have great difficulty getting it in upstream. Does ZFS really work on 32-bit mips anyway?

This revision now requires changes to proceed.Oct 15 2020, 10:04 AM
sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
67
  • cmn_err is a illumnos gcc extension type like our printf0 is for kernel print formatting things
  • we implement cmn_err in our own ZFS code because again, things expect it
  • i literally stole this macro check from our own kernel sources - sys/sys/cdefs.h - as to whether to use our internal printf0 for the extended types or not.

I'd be happy to just totally kill checking KPRINTFLIKE, but it /reads/ to me like KPRINTFLIKE is intended for kernel printfs that use the same print formatting as our kernel, and that's optionally printf0 on our forked gcc compilers.

sys/contrib/openzfs/module/zfs/spa.c
1388

It's only crazy before we again assume an int type is a pointer type, and this causes the zfs code to fail to compile on lib32 when building 64 bit amd64.

sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
67

Ah, OK. I guess then that we just need the above two lines. we can kill the ifdef and the whole else clause you've written.

sys/contrib/openzfs/module/zfs/spa.c
1388

Ah, I see the issue better now that I've got more sleep and it's the light of day... I got confused last night :(

Yes, technically this does need that cast, and you should try to upstream it first since a small change like this likely will go in w/o any hassle. Since OpenZFS upstream is a little fussy, I'd at least give it a shot at upstreaming in this case to reduce churn...