diff options
author | Paul Moore <pmoore@redhat.com> | 2012-03-07 10:54:47 -0500 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2012-03-09 11:47:53 -0500 |
commit | 177ca32a687e02313da118e1fd25d87911745255 (patch) | |
tree | 8658e77315e66f126b34fc4dbbd742d174cc562f | |
parent | 3cadb3d52472e05f4489a36a63ce9835e3619b2f (diff) | |
download | libseccomp-177ca32a687e02313da118e1fd25d87911745255.tar.gz |
arch: set the arch_def->token value
Unfortunately, there doesn't appear to be a great way to detect this,
so we need to depend on some GCC specific pre-processor #defines.
For reasons that should be obvious, we also change the default compiler
from whatever make provides via "$(CC)" to "gcc".
Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r-- | macros.mk | 10 | ||||
-rw-r--r-- | src/arch.c | 11 |
2 files changed, 15 insertions, 6 deletions
@@ -54,7 +54,7 @@ ECHO ?= echo SED ?= sed -# we require gcc specific functionality (see the MAKEDEP definitions below) +# we require gcc specific functionality GCC ?= gcc # @@ -86,10 +86,10 @@ VERSION_HDR = src/version.h # ARCHIVE = @echo " AR $@ (add/update: $?)"; $(AR) -cru $@ $?; -COMPILE = @echo " CC $@"; $(CC) $(CFLAGS) $(INCFLAGS) -o $@ -c $<; -COMPILE_EXEC = @echo " CC $@"; $(CC) $(CFLAGS) $(INCFLAGS) -o $@ $< $(LDFLAGS); -LINK_EXEC = @echo " LD $@"; $(CC) $(LDFLAGS) -o $@ $^ $(LIBFLAGS); -LINK_LIB = @echo " LD $@ "; $(CC) $(LDFLAGS) -o $@ $^ -shared -Wl,-soname=$@; +COMPILE = @echo " CC $@"; $(GCC) $(CFLAGS) $(INCFLAGS) -o $@ -c $<; +COMPILE_EXEC = @echo " CC $@"; $(GCC) $(CFLAGS) $(INCFLAGS) -o $@ $< $(LDFLAGS); +LINK_EXEC = @echo " LD $@"; $(GCC) $(LDFLAGS) -o $@ $^ $(LIBFLAGS); +LINK_LIB = @echo " LD $@ "; $(GCC) $(LDFLAGS) -o $@ $^ -shared -Wl,-soname=$@; # # default build targets @@ -21,11 +21,19 @@ #include <stdlib.h> #include <asm/bitsperlong.h> +#include <linux/audit.h> #include "arch.h" const struct arch_def arch_def_native = { - .token = 0, +#if __i386__ + .token = AUDIT_ARCH_I386, +#elif __x86_64__ + .token = AUDIT_ARCH_X86_64, +#else +#error the arch code needs to know about your machine type +#endif /* machine type guess */ + #if __BITS_PER_LONG == 32 .size = ARCH_SIZE_32, #elif __BITS_PER_LONG == 64 @@ -33,6 +41,7 @@ const struct arch_def arch_def_native = { #else .size = ARCH_SIZE_UNSPEC, #endif /* BITS_PER_LONG */ + #if __BYTE_ORDER == __LITTLE_ENDIAN .endian = ARCH_ENDIAN_LITTLE, #elif __BYTE_ORDER == __BIG_ENDIAN |