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

Commit 48cf170d5 breaks PowerPC build on FreeBSD #13934

Closed
mmatuska opened this issue Sep 21, 2022 · 3 comments
Closed

Commit 48cf170d5 breaks PowerPC build on FreeBSD #13934

mmatuska opened this issue Sep 21, 2022 · 3 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@mmatuska
Copy link
Contributor

System information

Type Version/Name
Distribution Name FreeBSD
Distribution Version 14.0-CURRENT
Kernel Version 14.0-CURRENT main-n258120-c7046f76c2c0
Architecture PowerPC
OpenZFS Version 2.1.99-FreeBSD_gc629f0bf6

Describe the problem you're observing

lib/libspl/include/sys/simd.h: getauxval() declared on line 456 is redeclared on line 461

extern unsigned long getauxval(unsigned long type);
#if defined(__FreeBSD__)
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_HWCAP2 26 /* CPU feature flags 2. */
extern int elf_aux_info(int aux, void *buf, int buflen);
static unsigned long getauxval(unsigned long key)

Describe how to reproduce the problem

Try to compile for PowerPC on FreeBSD

Include any warning/errors/backtraces from the system logs

In file included from /usr/src/sys/contrib/openzfs/module/icp/algs/aes/aes_impl.c:28:
/usr/src/sys/contrib/openzfs/lib/libspl/include/sys/simd.h:461:22: error: static declaration of 'getauxval' follows non-static declaration
static unsigned long getauxval(unsigned long key)
                     ^
/usr/src/sys/contrib/openzfs/lib/libspl/include/sys/simd.h:456:22: note: previous declaration is here
extern unsigned long getauxval(unsigned long type);
                     ^
@mmatuska mmatuska added the Type: Defect Incorrect behavior (e.g. crash, hang) label Sep 21, 2022
@mmatuska
Copy link
Contributor Author

@mcmilk please verify

@mcmilk
Copy link
Contributor

mcmilk commented Sep 22, 2022

@mcmilk please verify

I am sorry for this. The declaration of extern unsigned long getauxval(unsigned long type) belongs to the linux section.
I created a PR for fixing this: #13936 - could you test this please.

@mmatuska
Copy link
Contributor Author

@mcmilk thanks, but we need more:

in include/os/freebsd/spl/sys/simd_powerpc.h:

  1. there is no <powerpc/cpu.h>, you want <machine/cpu.h>
    or does the build system provide otherwise? In FreeBSD base we need <machine/cpu.h>
  2. you are missing an #endif at the end of the file

#ifndef _FREEBSD_SIMD_POWERPC_H
#define _FREEBSD_SIMD_POWERPC_H
#include <sys/types.h>
#include <sys/cdefs.h>
#include <machine/pcb.h>
#include <powerpc/cpu.h>
#define kfpu_allowed() 1
#define kfpu_initialize(tsk) do {} while (0)
#define kfpu_begin() do {} while (0)
#define kfpu_end() do {} while (0)
#define kfpu_init() (0)
#define kfpu_fini() do {} while (0)
/*
* Check if Altivec is available
*/
static inline boolean_t
zfs_altivec_available(void)
{
return ((cpu_features & PPC_FEATURE_HAS_ALTIVEC) != 0);
}
/*
* Check if VSX is available
*/
static inline boolean_t
zfs_vsx_available(void)
{
return ((cpu_features & PPC_FEATURE_HAS_VSX) != 0);
}
/*
* Check if POWER ISA 2.07 is available (SHA2)
*/
static inline boolean_t
zfs_isa207_available(void)
{
return ((cpu_features2 & PPC_FEATURE2_ARCH_2_07) != 0);
}

andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Sep 28, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Sep 28, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Sep 28, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
andrewc12 pushed a commit to andrewc12/openzfs that referenced this issue Oct 1, 2022
The extern declaration is only for Linux, move this line
into the right #ifdef section.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Co-authored-by: Martin Matuska <mm@FreeBSD.org>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#13934
Closes openzfs#13936
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

2 participants