summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-06-13 15:46:09 +0000
committerMike Frysinger <vapier@gentoo.org>2012-06-13 15:46:09 +0000
commitf34ebee393e891ce3fc292c11f8eefecc4f08c6a (patch)
tree5e3621d88c15e47046a5fb651c3049644ec5efea /sys-apps/kmod/files
parentImport to the main tree. Fix again openmp check for non gcc compilers (diff)
downloadhistorical-f34ebee393e891ce3fc292c11f8eefecc4f08c6a.tar.gz
historical-f34ebee393e891ce3fc292c11f8eefecc4f08c6a.tar.bz2
historical-f34ebee393e891ce3fc292c11f8eefecc4f08c6a.zip
Add fix from upstream for building w/out gc-sections.
Package-Manager: portage-2.2.0_alpha110/cvs/Linux x86_64
Diffstat (limited to 'sys-apps/kmod/files')
-rw-r--r--sys-apps/kmod/files/kmod-8-gc-sections.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/sys-apps/kmod/files/kmod-8-gc-sections.patch b/sys-apps/kmod/files/kmod-8-gc-sections.patch
new file mode 100644
index 000000000000..dbd6acfe3151
--- /dev/null
+++ b/sys-apps/kmod/files/kmod-8-gc-sections.patch
@@ -0,0 +1,117 @@
+From d30319e4335bcf76101e28d81c9a7c2ec9187cb7 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 15 May 2012 19:29:44 -0300
+Subject: [PATCH] libkmod: move function to the only file using it
+
+If we don't have --gc-sections support, linking kmod fails:
+libkmod/.libs/libkmod-util.a(libkmod-util.o): In function 'underscores':
+libkmod/libkmod-util.c:117: undefined reference to 'kmod_log'
+
+This is because libkmod-util.la uses kmod_log(), that is in libkmod.la.
+Move the function so we don't have a dependency loop while building the
+libraries and it works with compilers with no support for --gc-sections.
+---
+ libkmod/libkmod-config.c | 31 +++++++++++++++++++++++++++++++
+ libkmod/libkmod-util.c | 31 -------------------------------
+ libkmod/libkmod-util.h | 1 -
+ 3 files changed, 31 insertions(+), 32 deletions(-)
+
+diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
+index 586d3fa..d0f7848 100644
+--- a/libkmod/libkmod-config.c
++++ b/libkmod/libkmod-config.c
+@@ -108,6 +108,37 @@ const char * const *kmod_softdep_get_post(const struct kmod_list *l, unsigned in
+ return dep->post;
+ }
+
++/*
++ * Replace dashes with underscores.
++ * Dashes inside character range patterns (e.g. [0-9]) are left unchanged.
++ */
++static char *underscores(struct kmod_ctx *ctx, char *s)
++{
++ unsigned int i;
++
++ if (!s)
++ return NULL;
++
++ for (i = 0; s[i]; i++) {
++ switch (s[i]) {
++ case '-':
++ s[i] = '_';
++ break;
++
++ case ']':
++ INFO(ctx, "Unmatched bracket in %s\n", s);
++ break;
++
++ case '[':
++ i += strcspn(&s[i], "]");
++ if (!s[i])
++ INFO(ctx, "Unmatched bracket in %s\n", s);
++ break;
++ }
++ }
++ return s;
++}
++
+ static int kmod_config_add_command(struct kmod_config *config,
+ const char *modname,
+ const char *command,
+diff --git a/libkmod/libkmod-util.c b/libkmod/libkmod-util.c
+index f499578..0fa90f9 100644
+--- a/libkmod/libkmod-util.c
++++ b/libkmod/libkmod-util.c
+@@ -90,37 +90,6 @@ char *getline_wrapped(FILE *fp, unsigned int *linenum)
+ }
+ }
+
+-/*
+- * Replace dashes with underscores.
+- * Dashes inside character range patterns (e.g. [0-9]) are left unchanged.
+- */
+-char *underscores(struct kmod_ctx *ctx, char *s)
+-{
+- unsigned int i;
+-
+- if (!s)
+- return NULL;
+-
+- for (i = 0; s[i]; i++) {
+- switch (s[i]) {
+- case '-':
+- s[i] = '_';
+- break;
+-
+- case ']':
+- INFO(ctx, "Unmatched bracket in %s\n", s);
+- break;
+-
+- case '[':
+- i += strcspn(&s[i], "]");
+- if (!s[i])
+- INFO(ctx, "Unmatched bracket in %s\n", s);
+- break;
+- }
+- }
+- return s;
+-}
+-
+ inline int alias_normalize(const char *alias, char buf[PATH_MAX], size_t *len)
+ {
+ size_t s;
+diff --git a/libkmod/libkmod-util.h b/libkmod/libkmod-util.h
+index 317b2f7..163b187 100644
+--- a/libkmod/libkmod-util.h
++++ b/libkmod/libkmod-util.h
+@@ -9,7 +9,6 @@
+
+
+ char *getline_wrapped(FILE *fp, unsigned int *linenum) __attribute__((nonnull(1)));
+-char *underscores(struct kmod_ctx *ctx, char *s) __attribute__((nonnull(1, 2)));
+ #define streq(a, b) (strcmp((a), (b)) == 0)
+ #define strstartswith(a, b) (strncmp(a, b, strlen(b)) == 0)
+ void *memdup(const void *p, size_t n) __attribute__((nonnull(1)));
+--
+1.7.9.7
+