[kernel] r7045 - in dists/trunk/linux-kbuild-2.6/src/mod:
real-lsb-32 real-lsb-64 real-msb-32 real-msb-64
Bastian Blank
waldi at costa.debian.org
Wed Jul 19 22:56:44 UTC 2006
Author: waldi
Date: Wed Jul 19 22:56:40 2006
New Revision: 7045
Added:
dists/trunk/linux-kbuild-2.6/src/mod/Makefile.real
dists/trunk/linux-kbuild-2.6/src/mod/elfconfig.h
dists/trunk/linux-kbuild-2.6/src/mod/modpost.c
dists/trunk/linux-kbuild-2.6/src/mod/real-lsb-32/
dists/trunk/linux-kbuild-2.6/src/mod/real-lsb-32/elfconfig.h
dists/trunk/linux-kbuild-2.6/src/mod/real-lsb-64/
dists/trunk/linux-kbuild-2.6/src/mod/real-lsb-64/elfconfig.h
dists/trunk/linux-kbuild-2.6/src/mod/real-msb-32/
dists/trunk/linux-kbuild-2.6/src/mod/real-msb-32/elfconfig.h
dists/trunk/linux-kbuild-2.6/src/mod/real-msb-64/
dists/trunk/linux-kbuild-2.6/src/mod/real-msb-64/elfconfig.h
Removed:
dists/trunk/linux-kbuild-2.6/src/mod/elf.cpp
dists/trunk/linux-kbuild-2.6/src/mod/elf.hpp
dists/trunk/linux-kbuild-2.6/src/mod/endian.hpp
dists/trunk/linux-kbuild-2.6/src/mod/modpost.cpp
dists/trunk/linux-kbuild-2.6/src/mod/module.cpp
dists/trunk/linux-kbuild-2.6/src/mod/module.hpp
dists/trunk/linux-kbuild-2.6/src/mod/module_devicetable.cpp
dists/trunk/linux-kbuild-2.6/src/mod/module_devicetable.hpp
dists/trunk/linux-kbuild-2.6/src/mod/module_devicetable.tpp
dists/trunk/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.cpp
dists/trunk/linux-kbuild-2.6/src/mod/module_devicetable_impl_2_6_16.hpp
Modified:
dists/trunk/linux-kbuild-2.6/src/mod/Makefile
Log:
Replace own modpost with a dispatcher and four version of the original one.
* src/mod/Makefile: Build all modpost variants.
* src/mod/Makefile.real, src/mod/elfconfig.h, src/mod/modpost.c,
src/mod/real-lsb-32/elfconfig.h, src/mod/real-lsb-64/elfconfig.h,
src/mod/real-msb-32/elfconfig.h, src/mod/real-msb-64/elfconfig.h: Add.
* src/mod/real-lsb-32, src/mod/real-lsb-64, src/mod/real-msb-32,
src/mod/real-msb-64: New directory.
* src/mod/elf.cpp, src/mod/elf.hpp, src/mod/endian.hpp, src/mod/modpost.cpp,
src/mod/module.cpp, src/mod/module.hpp, src/mod/module_devicetable.cpp,
src/mod/module_devicetable.hpp, src/mod/module_devicetable.tpp,
src/mod/module_devicetable_impl_2_6_16.cpp,
src/mod/module_devicetable_impl_2_6_16.hpp: Remove.
Modified: dists/trunk/linux-kbuild-2.6/src/mod/Makefile
==============================================================================
--- dists/trunk/linux-kbuild-2.6/src/mod/Makefile (original)
+++ dists/trunk/linux-kbuild-2.6/src/mod/Makefile Wed Jul 19 22:56:40 2006
@@ -1,13 +1,20 @@
-PROGS = modpost
+PROGS = \
+ modpost \
+ modpost.real-lsb-32 \
+ modpost.real-lsb-64 \
+ modpost.real-msb-32 \
+ modpost.real-msb-64
OUTDIR = mod
-modpost: elf.o modpost.o module.o module_devicetable.o module_devicetable_impl_2_6_16.o
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^
+modpost.real-%:
+ $(MAKE) -f Makefile.real TYPE=$* SOURCEDIR=$(top_srcdir)/scripts/mod
-%.o: %.cpp %.hpp endian.hpp
+%: %.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+include ../Makefile.inc
clean:
rm $(PROGS) *.o
-include ../Makefile.inc
Added: dists/trunk/linux-kbuild-2.6/src/mod/Makefile.real
==============================================================================
--- (empty file)
+++ dists/trunk/linux-kbuild-2.6/src/mod/Makefile.real Wed Jul 19 22:56:40 2006
@@ -0,0 +1,10 @@
+PROGS = modpost.real-$(TYPE)
+
+include ../Makefile.inc
+
+modpost.real-$(TYPE): file2alias.real-$(TYPE).o modpost.real-$(TYPE).o sumversion.real-$(TYPE).o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+%.real-$(TYPE).o: $(SOURCEDIR)/%.c
+ $(CC) -I real-$(TYPE) $(CFLAGS) -c -o $@ $^
+
Added: dists/trunk/linux-kbuild-2.6/src/mod/elfconfig.h
==============================================================================
--- (empty file)
+++ dists/trunk/linux-kbuild-2.6/src/mod/elfconfig.h Wed Jul 19 22:56:40 2006
@@ -0,0 +1,7 @@
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define HOST_ELFDATA ELFDATA2LSB
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define HOST_ELFDATA ELFDATA2MSB
+#endif
Added: dists/trunk/linux-kbuild-2.6/src/mod/modpost.c
==============================================================================
--- (empty file)
+++ dists/trunk/linux-kbuild-2.6/src/mod/modpost.c Wed Jul 19 22:56:40 2006
@@ -0,0 +1,69 @@
+#include <elf.h>
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int main (int argc, char *argv[])
+{
+ char const *data, *class;
+ char prog[1024];
+ unsigned char ei[EI_NIDENT];
+ int opt;
+ FILE *file;
+
+ while ((opt = getopt (argc, argv, "ai:I:mo:")) != -1)
+ {
+ switch(opt)
+ {
+ case 'a':
+ case 'i':
+ case 'I':
+ case 'm':
+ case 'o':
+ break;
+ default:
+ return 1;
+ }
+ }
+
+ if (!(file = fopen (argv[optind], "r")))
+ {
+ fprintf (stderr, "Can't open file\n");
+ return 1;
+ }
+ if (fread (ei, 1, EI_NIDENT, file) != EI_NIDENT)
+ {
+ fprintf (stderr, "Error: input truncated\n");
+ return 1;
+ }
+ if (memcmp (ei, ELFMAG, SELFMAG) != 0)
+ {
+ fprintf (stderr, "Error: not ELF\n");
+ return 1;
+ }
+ switch (ei[EI_DATA]) {
+ case ELFDATA2LSB:
+ data = "lsb";
+ break;
+ case ELFDATA2MSB:
+ data = "msb";
+ break;
+ default:
+ return 1;
+ }
+ switch (ei[EI_CLASS]) {
+ case ELFCLASS32:
+ class = "32";
+ break;
+ case ELFCLASS64:
+ class = "64";
+ break;
+ default:
+ return 1;
+ }
+ snprintf (prog, sizeof prog, "%s.real-%s-%s", argv[0], data, class);
+
+ return execv (prog, argv);
+}
Added: dists/trunk/linux-kbuild-2.6/src/mod/real-lsb-32/elfconfig.h
==============================================================================
--- (empty file)
+++ dists/trunk/linux-kbuild-2.6/src/mod/real-lsb-32/elfconfig.h Wed Jul 19 22:56:40 2006
@@ -0,0 +1,4 @@
+#define KERNEL_ELFCLASS ELFCLASS32
+#define KERNEL_ELFDATA ELFDATA2LSB
+#define MODULE_SYMBOL_PREFIX ""
+#include "../elfconfig.h"
Added: dists/trunk/linux-kbuild-2.6/src/mod/real-lsb-64/elfconfig.h
==============================================================================
--- (empty file)
+++ dists/trunk/linux-kbuild-2.6/src/mod/real-lsb-64/elfconfig.h Wed Jul 19 22:56:40 2006
@@ -0,0 +1,4 @@
+#define KERNEL_ELFCLASS ELFCLASS64
+#define KERNEL_ELFDATA ELFDATA2LSB
+#define MODULE_SYMBOL_PREFIX ""
+#include "../elfconfig.h"
Added: dists/trunk/linux-kbuild-2.6/src/mod/real-msb-32/elfconfig.h
==============================================================================
--- (empty file)
+++ dists/trunk/linux-kbuild-2.6/src/mod/real-msb-32/elfconfig.h Wed Jul 19 22:56:40 2006
@@ -0,0 +1,4 @@
+#define KERNEL_ELFCLASS ELFCLASS32
+#define KERNEL_ELFDATA ELFDATA2MSB
+#define MODULE_SYMBOL_PREFIX ""
+#include "../elfconfig.h"
Added: dists/trunk/linux-kbuild-2.6/src/mod/real-msb-64/elfconfig.h
==============================================================================
--- (empty file)
+++ dists/trunk/linux-kbuild-2.6/src/mod/real-msb-64/elfconfig.h Wed Jul 19 22:56:40 2006
@@ -0,0 +1,4 @@
+#define KERNEL_ELFCLASS ELFCLASS64
+#define KERNEL_ELFDATA ELFDATA2MSB
+#define MODULE_SYMBOL_PREFIX ""
+#include "../elfconfig.h"
More information about the Kernel-svn-changes
mailing list