Hello,

It looks like we've hit a variant of
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763

The attached patch fixes the problem for me. It simply avoids calling the file local open() function and inlines their code instead. Additionally it adds O_LARGEFILE to the oflags.

Hans, please review.

Thanks,
Gregor

>From be2de842647ea51a84fdfab21056639ba1cc67b4 Mon Sep 17 00:00:00 2001
From: Gregor Jasny <gja...@googlemail.com>
Date: Wed, 4 Apr 2012 13:40:56 +0200
Subject: [PATCH] Work around GCC 4.7 inlining problem

With GCC 4.7 and enabled stack protector we get an compiler error
about fained inlining. (See http://bugs.debian.org/667406)

This patch avoids calling the file local open function and inlines
their code instead.

Signed-off-by: Gregor Jasny <gregor.ja...@citrix.com>
---
 lib/libv4l2/v4l2convert.c |   31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c
index 9e2f546..1347726 100644
--- a/lib/libv4l2/v4l2convert.c
+++ b/lib/libv4l2/v4l2convert.c
@@ -45,6 +45,11 @@
 
 LIBV4L_PUBLIC int open(const char *file, int oflag, ...)
 {
+}
+
+#ifdef linux
+LIBV4L_PUBLIC int open64(const char *file, int oflag, ...)
+{
        int fd;
        struct v4l2_capability cap;
        int v4l_device = 0;
@@ -57,6 +62,8 @@ LIBV4L_PUBLIC int open(const char *file, int oflag, ...)
                v4l_device = 1;
        }
 
+       oflag |= O_LARGEFILE;
+
        /* original open code */
        if (oflag & O_CREAT) {
                va_list ap;
@@ -90,30 +97,6 @@ LIBV4L_PUBLIC int open(const char *file, int oflag, ...)
 
        return fd;
 }
-
-#ifdef linux
-LIBV4L_PUBLIC int open64(const char *file, int oflag, ...)
-{
-       int fd;
-
-       /* original open code */
-       if (oflag & O_CREAT) {
-               va_list ap;
-               mode_t mode;
-
-               va_start(ap, oflag);
-               mode = va_arg(ap, mode_t);
-
-               fd = open(file, oflag | O_LARGEFILE, mode);
-
-               va_end(ap);
-       } else {
-               fd = open(file, oflag | O_LARGEFILE);
-       }
-       /* end of original open code */
-
-       return fd;
-}
 #endif
 
 LIBV4L_PUBLIC int close(int fd)
-- 
1.7.9.5

Reply via email to