[PATCH] Check for existence of mempcpy

Ulf Hermann ulf.hermann@qt.io
Fri Feb 17 12:16:00 GMT 2017

> If at all possible I would like elfutils to not turn into some
> abstraction layer for broken non-GNU/Linux systems. I don't mind small
> (mostly) obvious correct defines/checks or tweaks to help out people
> using such broken systems. But if we need a lot more of these things I
> think we should look if we can just import the necessary gnulib modules
> to get portability functions.

I've actually done that, but the amount of stuff that would need to be imported is staggering (see for example https://codereview.qt-project.org/#/c/182654/13) and comes with a serious mess of different licenses.

I've since switched to a different strategy where I rather disable features than import large gnulib modules. Disabling maintainer mode (for obstack) and any code that uses argp certainly helps. The remaining pain point is tsearch/tfind/tdelete/tdestroy for which we probably need third party code. Another problem is that we need fts for dwfl_linux_kernel_*. I'm on the edge on whether to include the gnulib implementation or disable it.

The retrying I/O functions can be implemented on top of either Linux/GNU or windows API and I would just move them to a separate file which I can replace based on availability of one or the other (I don't need to upstream the windows implementation). This technique will require universally using the retrying variants rather than the plain ones, which is a good thing anyway.

Replacements for mmap() and dlopen() on windows are a somewhat more involved matter but I don't really need to upstream them either, if you don't want them.

All other missing functions are just a few lines of C code each, which can either be pulled from gnulib or reimplemented. As I didn't want to taint myself with license problems I chose to reimplement them for now. But that can be decided on a case by case basis. Those are the patches I'm going to focus on next.

And then there are nonstandard C constructs, especially void* arithmetics and statement expressions, which I would like to replace with standards compliant C. That is a somewhat larger and not yet finished project, and I'm hoping you're generally open to it.


More information about the Elfutils-devel mailing list