Skip to contentSkip to conversation

libv4l: fixup lfs mismatch in preload libraries

PATCH In review Ezequiel Garcia 4 participants 7 messages Jul 11, 2018 – Jul 12, 2018 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libv4l: fixup lfs mismatch in preload libraries

From: Peter Korsgaard <[email protected]>

Ensure that the lfs variants are not transparently used instead of the !lfs ones so both can be wrapped, independently of any custom CFLAGS/CPPFLAGS.

Without this patch, the following assembler errors appear during cross-compiling with Buildroot:

/tmp/ccc3gdJg.s: Assembler messages:
/tmp/ccc3gdJg.s:67: Error: symbol open64' is already defined /tmp/ccc3gdJg.s:130: Error: symbol mmap64' is already defined

---
 lib/libv4l1/v4l1compat.c  | 3 +++
 lib/libv4l2/v4l2convert.c | 3 +++
 2 files changed, 6 insertions(+)
lib/libv4l1/v4l1compat.c +3 -0
index cb79629ff88f..e5c9e56261e2 100644
@@ -19,6 +19,9 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
  */
 
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS
 #define _LARGEFILE64_SOURCE 1
 
 #include <config.h>
lib/libv4l2/v4l2convert.c +3 -0
index 7c9a04c086ed..13ca4cfb1b08 100644
@@ -23,6 +23,9 @@
 /* prevent GCC 4.7 inlining error */
 #undef _FORTIFY_SOURCE
 
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS
 #define _LARGEFILE64_SOURCE 1
 
 #ifdef ANDROID
Signature · 1 line
2.18.0.rc2
#1 lore raw

Em Wed, 11 Jul 2018 10:22:51 -0300 Ezequiel Garcia <[email protected]> escreveu:

Quoted 24 lines

From: Peter Korsgaard <[email protected]>

Ensure that the lfs variants are not transparently used instead of the !lfs ones so both can be wrapped, independently of any custom CFLAGS/CPPFLAGS.

Without this patch, the following assembler errors appear during cross-compiling with Buildroot:

/tmp/ccc3gdJg.s: Assembler messages:
/tmp/ccc3gdJg.s:67: Error: symbol open64' is already defined /tmp/ccc3gdJg.s:130: Error: symbol mmap64' is already defined

---
 lib/libv4l1/v4l1compat.c  | 3 +++
 lib/libv4l2/v4l2convert.c | 3 +++
 2 files changed, 6 insertions(+)
lib/libv4l1/v4l1compat.c +0 -0
index cb79629ff88f..e5c9e56261e2 100644

lib/libv4l1/v4l1compat.c line 24

Quoted 6 lines
lib/libv4l1/v4l1compat.c +3 -0
@@ -19,6 +19,9 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
  */
 
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS

Hmm... shouldn't this be autodetected? I didn't check anything, but I would be expecting that different distros (and BSD) may be doing different things here, specially if they use different gcc versions or even different libc implementations.

Quoted 8 lines
lib/libv4l1/v4l1compat.c +0 -0
 #define _LARGEFILE64_SOURCE 1
 
 #include <config.h>
lib/libv4l2/v4l2convert.c +0 -0
index 7c9a04c086ed..13ca4cfb1b08 100644

lib/libv4l2/v4l2convert.c line 31

Quoted 9 lines
lib/libv4l2/v4l2convert.c +3 -0
@@ -23,6 +23,9 @@
 /* prevent GCC 4.7 inlining error */
 #undef _FORTIFY_SOURCE
 
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS
 #define _LARGEFILE64_SOURCE 1
 
 #ifdef ANDROID

Thanks,
Mauro

#2 lore raw

Hi Mauro,

Added Peter's updated address to Cc.

Quoted 30 lines · Mauro Carvalho Chehab

Em Wed, 11 Jul 2018 10:22:51 -0300 Ezequiel Garcia <[email protected]> escreveu:

Quoted 27 lines

From: Peter Korsgaard <[email protected]>

Ensure that the lfs variants are not transparently used instead of the !lfs ones so both can be wrapped, independently of any custom CFLAGS/CPPFLAGS.

Without this patch, the following assembler errors appear during cross-compiling with Buildroot:

/tmp/ccc3gdJg.s: Assembler messages:
/tmp/ccc3gdJg.s:67: Error: symbol open64' is already defined /tmp/ccc3gdJg.s:130: Error: symbol mmap64' is already defined

---
 lib/libv4l1/v4l1compat.c  | 3 +++
 lib/libv4l2/v4l2convert.c | 3 +++
 2 files changed, 6 insertions(+)
lib/libv4l1/v4l1compat.c +0 -0
index cb79629ff88f..e5c9e56261e2 100644
@@ -19,6 +19,9 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
  */
 
Quoted 8 lines

lib/libv4l1/v4l1compat.c line 24

Quoted 3 lines
lib/libv4l1/v4l1compat.c +3 -0
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS

Hmm... shouldn't this be autodetected? I didn't check anything, but I would be expecting that different distros (and BSD) may be doing different things here, specially if they use different gcc versions or even different libc implementations.

See Peter's explanation here:

http://lists.busybox.net/pipermail/buildroot/2017-December/210067.html

baruch

Quoted 17 lines
Quoted 17 lines
lib/libv4l1/v4l1compat.c +0 -0
 #define _LARGEFILE64_SOURCE 1
 
 #include <config.h>
lib/libv4l2/v4l2convert.c +3 -0
index 7c9a04c086ed..13ca4cfb1b08 100644
@@ -23,6 +23,9 @@
 /* prevent GCC 4.7 inlining error */
 #undef _FORTIFY_SOURCE
 
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS
 #define _LARGEFILE64_SOURCE 1
 
 #ifdef ANDROID
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
#3 lore raw
Quoted 48 lines · Baruch Siach

Hi Mauro,

Added Peter's updated address to Cc.

Quoted 33 lines · Mauro Carvalho Chehab

Em Wed, 11 Jul 2018 10:22:51 -0300 Ezequiel Garcia <[email protected]> escreveu:

Quoted 30 lines

From: Peter Korsgaard <[email protected]>

Ensure that the lfs variants are not transparently used instead of the !lfs
ones so both can be wrapped, independently of any custom CFLAGS/CPPFLAGS.

Without this patch, the following assembler errors appear during cross-compiling with Buildroot:

/tmp/ccc3gdJg.s: Assembler messages:
/tmp/ccc3gdJg.s:67: Error: symbol open64' is already defined /tmp/ccc3gdJg.s:130: Error: symbol mmap64' is already defined

---
 lib/libv4l1/v4l1compat.c  | 3 +++
 lib/libv4l2/v4l2convert.c | 3 +++
 2 files changed, 6 insertions(+)
lib/libv4l1/v4l1compat.c +0 -0
index cb79629ff88f..e5c9e56261e2 100644
@@ -19,6 +19,9 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston,

MA 02110-1335 USA
*/

Quoted 9 lines

lib/libv4l1/v4l1compat.c

Quoted 4 lines

+/* ensure we see *64 variants and they aren't transparently used */

lib/libv4l1/v4l1compat.c +2 -0
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS

Hmm... shouldn't this be autodetected? I didn't check anything, but I would be expecting that different distros (and BSD) may be doing different things here, specially if they use different gcc versions or even different libc implementations.

Quoted 6 lines

See Peter's explanation here:

http://lists.busybox.net/pipermail/buildroot/2017-December/210067.h
tml

Nice, thanks for Ccing the real Peter and for adding the link to the discussion.

Regards,
Eze

#4 lore raw
In reply to Baruch Siach

Em Wed, 11 Jul 2018 22:38:56 +0300
Baruch Siach <[email protected]> escreveu:

Quoted 44 lines

Hi Mauro,

Added Peter's updated address to Cc.

Quoted 30 lines · Mauro Carvalho Chehab

Em Wed, 11 Jul 2018 10:22:51 -0300 Ezequiel Garcia <[email protected]> escreveu:

Quoted 27 lines

From: Peter Korsgaard <[email protected]>

Ensure that the lfs variants are not transparently used instead of the !lfs ones so both can be wrapped, independently of any custom CFLAGS/CPPFLAGS.

Without this patch, the following assembler errors appear during cross-compiling with Buildroot:

/tmp/ccc3gdJg.s: Assembler messages:
/tmp/ccc3gdJg.s:67: Error: symbol open64' is already defined /tmp/ccc3gdJg.s:130: Error: symbol mmap64' is already defined

---
 lib/libv4l1/v4l1compat.c  | 3 +++
 lib/libv4l2/v4l2convert.c | 3 +++
 2 files changed, 6 insertions(+)
lib/libv4l1/v4l1compat.c +0 -0
index cb79629ff88f..e5c9e56261e2 100644
@@ -19,6 +19,9 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
  */
 
Quoted 8 lines

lib/libv4l1/v4l1compat.c line 24

Quoted 3 lines
lib/libv4l1/v4l1compat.c +3 -0
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS  

Hmm... shouldn't this be autodetected? I didn't check anything, but I would be expecting that different distros (and BSD) may be doing different things here, specially if they use different gcc versions or even different libc implementations.

Quoted 3 lines

See Peter's explanation here:

http://lists.busybox.net/pipermail/buildroot/2017-December/210067.html

The link Peter provided seems to be specific to glibc. The main point I want to bring is: would this change affect users with other setups? There are some users that compile it against FreeBSD and Android. Some compile using dietlibc or uclibc. Also, people build it against 32-bits and 64-bits on x86, arm and other archs.

So, the question is: are you sure that the above change is also valid for *all* other environments? If not, I would be expecting it to be attached to some automake test, to be sure that it will be applied only to the affected setups.

Quoted 14 lines

baruch

Quoted 11 lines
Quoted 11 lines
lib/libv4l1/v4l1compat.c +0 -0
 #define _LARGEFILE64_SOURCE 1
 
 #include <config.h>
lib/libv4l2/v4l2convert.c +0 -0
index 7c9a04c086ed..13ca4cfb1b08 100644
@@ -23,6 +23,9 @@
 /* prevent GCC 4.7 inlining error */
 #undef _FORTIFY_SOURCE
 
Quoted 8 lines
Quoted 6 lines

lib/libv4l2/v4l2convert.c line 31

Quoted 6 lines
lib/libv4l2/v4l2convert.c +3 -0
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS
 #define _LARGEFILE64_SOURCE 1
 
 #ifdef ANDROID  

Thanks,
Mauro

#5 lore raw
Quoted 54 lines · Mauro Carvalho Chehab

Em Wed, 11 Jul 2018 22:38:56 +0300
Baruch Siach <[email protected]> escreveu:

Quoted 42 lines

Added Peter's updated address to Cc.

Quoted 30 lines · Mauro Carvalho Chehab

Em Wed, 11 Jul 2018 10:22:51 -0300 Ezequiel Garcia <[email protected]> escreveu:

Quoted 27 lines

From: Peter Korsgaard <[email protected]>

Ensure that the lfs variants are not transparently used instead of the !lfs ones so both can be wrapped, independently of any custom CFLAGS/CPPFLAGS.

Without this patch, the following assembler errors appear during cross-compiling with Buildroot:

/tmp/ccc3gdJg.s: Assembler messages:
/tmp/ccc3gdJg.s:67: Error: symbol open64' is already defined /tmp/ccc3gdJg.s:130: Error: symbol mmap64' is already defined

---
 lib/libv4l1/v4l1compat.c  | 3 +++
 lib/libv4l2/v4l2convert.c | 3 +++
 2 files changed, 6 insertions(+)
lib/libv4l1/v4l1compat.c +0 -0
index cb79629ff88f..e5c9e56261e2 100644
@@ -19,6 +19,9 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
  */
 
Quoted 8 lines

lib/libv4l1/v4l1compat.c line 24

Quoted 3 lines
lib/libv4l1/v4l1compat.c +3 -0
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS

Hmm... shouldn't this be autodetected? I didn't check anything, but I would be expecting that different distros (and BSD) may be doing different things here, specially if they use different gcc versions or even different libc implementations.

Quoted 3 lines

See Peter's explanation here:

http://lists.busybox.net/pipermail/buildroot/2017-December/210067.html

The link Peter provided seems to be specific to glibc. The main point I want to bring is: would this change affect users with other setups? There are some users that compile it against FreeBSD and Android. Some compile using dietlibc or uclibc. Also, people build it against 32-bits and 64-bits on x86, arm and other archs.

Quoted 4 lines

So, the question is: are you sure that the above change is also valid for *all* other environments? If not, I would be expecting it to be attached to some automake test, to be sure that it will be applied only to the affected setups.

Buildroot has been carrying this patch since 2012[1] with no one complaining. Buildroot supports glibc, uClibc, and musl libc on a wide range of architectures (x86, ARM, MIPS, PowerPC, Sparc, xtensa, arc, and more) both 32-bit and 64-bit.

I don't know about FreeBSD.

baruch

[1] https://git.buildroot.org/buildroot/commit/?id=d059b1cc61dcafde47723c45b834409026a39dbe

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
lib/libv4l1/v4l1compat.c +0 -0
 #define _LARGEFILE64_SOURCE 1
 
 #include <config.h>
lib/libv4l2/v4l2convert.c +0 -0
index 7c9a04c086ed..13ca4cfb1b08 100644
@@ -23,6 +23,9 @@
 /* prevent GCC 4.7 inlining error */
 #undef _FORTIFY_SOURCE
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

lib/libv4l2/v4l2convert.c line 31

Quoted 6 lines
lib/libv4l2/v4l2convert.c +3 -0
+/* ensure we see *64 variants and they aren't transparently used */
+#undef _LARGEFILE_SOURCE
+#undef _FILE_OFFSET_BITS
 #define _LARGEFILE64_SOURCE 1
 
 #ifdef ANDROID

--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -

#6 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

Hi,

Quoted 11 lines
Quoted 10 lines

The link Peter provided seems to be specific to glibc. The main point I want to bring is: would this change affect users with other setups? There are some users that compile it against FreeBSD and Android. Some compile using dietlibc or uclibc. Also, people build it against 32-bits and 64-bits on x86, arm and other archs.

So, the question is: are you sure that the above change is also valid for *all* other environments? If not, I would be expecting it to be attached to some automake test, to be sure that it will be applied only to the affected setups.

Quoted 4 lines

Buildroot has been carrying this patch since 2012[1] with no one complaining. Buildroot supports glibc, uClibc, and musl libc on a wide range of architectures (x86, ARM, MIPS, PowerPC, Sparc, xtensa, arc, and more) both 32-bit and 64-bit.

Indeed. I believe these comes from the single UNIX specification:

http://www.unix.org/version2/whatsnew/lfs20mar.html#3.3

And these defines are what the AC_SYS_LARGEFILE autoconf macro uses:

https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/System-Services.html

Signature · 1 line
Bye, Peter Korsgaard