[sane-devel] inb outb missing on mips

Luiz Angelo Daros de Luca luizluca at gmail.com
Thu Sep 10 04:15:00 UTC 2015


Hello,

I checked with other libc and got some more info about the problem.

Normally, sane-backends deal with ioperm/inb/outb like this:
a) sane-backends tries to use sys/io.h in order to provide inb/outb. If
missing, it implements them locally but only for i386 (old glibc?)
b) if ioperm is missing for any arch but i386. IO_SUPPORT_MISSING is
defined
c) if either ioperm is missing or IO_SUPPORT_MISSING is defined, inb/outb
will not be used.
c.1) the exception is backend/qcam.c, which tries to use inb/outb anyway
but it will not be compiled if ioperm is missing.

Now how libc implementations deal with iopem/inb/oub:

When uclibc is used:
* it provide sys/io.h for only i386/x32/x86_64 archs and it includes
 inb/outb
* it does not provide sys/io.h for non i386 arch
When musl is used:
* it provides sys/io.h for any arch that has ioperm syscall (which includes
mips, i386/x32/x86_64, powerpc, microblaze)
* it does not provide inb/outb for any arch expect i386/x32/x86_64 (using
bits/io.h included in sys/io.h)

What happens on sane-backend:
1) for i386/x32/x86_64 arch, any libc provides sys/io.h with ioperm and
inb/oub. Sane-backends compiles.
2) for any arch that does not implement ioperm syscall, ioperm is missing.
Sane-backends compiles.
3) for other non-i386/x32/x86_64-arch that provides ioperm syscall:
3.1) uclibc does not provide sys.io.h. Sane-backends compiles, except for
qcam.
3.2) musl provide sys.io.h but inb/outb is missing. Sane-backends fails
with multiple undefined symbols (inb/outb).

Some files affected are:
sanei/sanei_pio.c
sanei/sanei_ab306.c
sanei/sanei_pa4s2.c
sanei/sanei_pp.c
backend/umax_pp_low.c
backend/qcam.c

What is the best solution here? Should all checks for ioperm be replaced by
(or added with) checks for inb/outb (including disabling qcam in configure)?
It'll not break cases 1), 2) and it will fix 3.1 and 3.2.

Regards,




Em qua, 9 de set de 2015 às 19:04, Luiz Angelo Daros de Luca <
luizluca at gmail.com> escreveu:

> Hello,
>
> I'm trying to get rid of this patch:
>
> http://git.openwrt.org/?p=packages.git;a=blob_plain;f=utils/sane-backends/patches/020-non-i386-qcam.patch;hb=HEAD
>
> That helps sane-backend cross-compile for MIPS processor. But this seems
> to be a hacky solution.
>
> The problem seems that configure check for ioperm passes for MIPS with
> libc-musl (I didn't test with other libc), while inb and outb are still
> missing for this arch. As sane-backend uses HAVE_IOPERM in order to use or
> not in/outb, it compiles requiring inb/outb. This results in a linker error.
>
> Who is not playing nice here? musl providing ioperm where it shouldn't?
> configure failing to check correcly for ioperm? sane not checking for inb?
>
> Regards,
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20150910/f768ba38/attachment.html>


More information about the sane-devel mailing list