libgpg-error: Replace syscfg

Jörg Krause joerg.krause at embedded.rocks
Sun Mar 20 23:06:31 CET 2016


Hi,

the current mechanism to figure out platform specific properties when
cross-compiling brings a lot of maintenance burden to package
management systems. For example Buildroot manages the build of a
package and its dependencies in terms of other packages, available
architecuteres, toolchains, etc.

The current mechanism of running gen-posix-lock-obj on a remote target
for unsupported architectures is not suitable for building libgpg-error 
with Buildroot. 

Furthermore, we have to add a dependency of the architecture to the
package libgpg-error to disallow building on non-supported platforms.
The drawback is that many packages depends directly or indirectly on
libgpg-error, so that this dependency has to be propageted recursively.
AFAIK, libgpg-error has no limitations to not run on a target not
specified on syscfg.

I had a look on gen-posix-lock-obj and I am quite sure the logic can be
put into gpg-error.h itself. All necessary information are available at
compile time. This way, there would be no need for syscfg and gen-
posix-lock-obj anymore!

I used a simplified test main to cross-compile for ARM with musl libc:

#include <stdio.h>
#include <pthread.h>
#include <config.h>

typedef struct
{
  long _vers;
  union {
    volatile char _priv[SIZEOF_PTHREAD_MUTEX_T];
    long _x_align;
    long *_xp_align;
  } u;
} gpgrt_lock_t;

#define GPGRT_LOCK_DEFINE(name) \
  static gpgrt_lock_t name  = { LOCK_ABI_VERSION,
PTHREAD_MUTEX_INITIALIZER }

GPGRT_LOCK_DEFINE (simple_lock);

int main() {
  int i;
  gpgrt_lock_t *p;

  p = &simple_lock;

  for (i=0; i < SIZEOF_PTHREAD_MUTEX_T; i++)
    {
      if (i && !(i % 8))
        putchar ('\n');
      printf ("%u", p->u._priv[i]);
      if (i < SIZEOF_PTHREAD_MUTEX_T - 1)
        putchar (',');
    }
  putchar ('\n');
}

I'm quite sure syscfg and gen-posix-lock-obj can be replaced, but maybe
I missed something important here.

Best regards
Jörg Krause



More information about the Gnupg-devel mailing list