[dpdk-dev] [Bug 35] Does not compile with musl libc: drivers/bus/pci/linux/pci_uio.c

bugzilla at dpdk.org bugzilla at dpdk.org
Thu May 3 12:33:14 CEST 2018


https://dpdk.org/tracker/show_bug.cgi?id=35

            Bug ID: 35
           Summary: Does not compile with musl libc:
                    drivers/bus/pci/linux/pci_uio.c
           Product: DPDK
           Version: 18.05
          Hardware: All
                OS: All
            Status: CONFIRMED
          Severity: normal
          Priority: Normal
         Component: ethdev
          Assignee: dev at dpdk.org
          Reporter: dpdk at stormmq.com
  Target Milestone: ---

This does not compile on X86 because it assumes the presence of the glibc-only
functions `outl_p`, `outw_p` and `outb_p`. This can be fixed reliably for all c
libraries and operating systems by simply importing our own definitions, viz:-

```
#if defined(RTE_ARCH_X86)
#include <sys/io.h>

// Used in pci_uio_ioport_write, these functions are present in glibc
// in <sys/io.h> (without the pci_uio_ prefix) but not in the
// musl lib c.

static __inline void
pci_uio_outl_p(unsigned int value, unsigned short int port)
{
  __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (value),
                        "Nd" (port));
}

static __inline void
pci_uio_outw_p(unsigned short int value, unsigned short int port)
{
  __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (value),
                        "Nd" (port));
}

static __inline void
pci_uio_outb_p(unsigned char value, unsigned short int port)
{
  __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (value),
                        "Nd" (port));
}
```

And then prefixing the usages of the glibc-only functions with `pci_uio_`, eg
`outl_p` becomes `pci_uio_outlw_p`.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the dev mailing list