Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys drm2: build with -fwrapv, since the Linux kernel does an...



details:   https://anonhg.NetBSD.org/src/rev/0f96f1bfedc7
branches:  trunk
changeset: 983705:0f96f1bfedc7
user:      nia <nia%NetBSD.org@localhost>
date:      Wed Jun 02 15:45:28 2021 +0000

description:
drm2: build with -fwrapv, since the Linux kernel does and we don't
want to spend too much time fixing their code. silences a lot of
KUBSAN warnings.

we need to use COPTS to have per-option compiler flags. help from
Riastradh.

diffstat:

 sys/conf/Makefile.kern.inc                     |  4 ++--
 sys/external/bsd/drm2/drm/files.drmkms         |  6 +++++-
 sys/external/bsd/drm2/i915drm/files.i915drmkms |  6 +++++-
 sys/external/bsd/drm2/nouveau/files.nouveau    |  6 +++++-
 sys/external/bsd/drm2/radeon/files.radeon      |  6 +++++-
 5 files changed, 22 insertions(+), 6 deletions(-)

diffs (98 lines):

diff -r e02442c2792e -r 0f96f1bfedc7 sys/conf/Makefile.kern.inc
--- a/sys/conf/Makefile.kern.inc        Wed Jun 02 15:43:33 2021 +0000
+++ b/sys/conf/Makefile.kern.inc        Wed Jun 02 15:45:28 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.kern.inc,v 1.280 2021/04/06 15:05:12 simonb Exp $
+#      $NetBSD: Makefile.kern.inc,v 1.281 2021/06/02 15:45:28 nia Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -449,7 +449,7 @@
 CPPFLAGS+=     ${CPPFLAGS.${.IMPSRC:T}}
 CWARNFLAGS+=   ${CWARNFLAGS.${.IMPSRC:T}}
 
-.for _v in CFLAGS CPPFLAGS CWARNFLAGS
+.for _v in COPTS CPPFLAGS CWARNFLAGS
 .for _c in ${CSRCS}
 ${_v}.${_c:T}+=${OPT.${_c:T}:@.o.@${${_v}.${.o.}}@}
 .endfor
diff -r e02442c2792e -r 0f96f1bfedc7 sys/external/bsd/drm2/drm/files.drmkms
--- a/sys/external/bsd/drm2/drm/files.drmkms    Wed Jun 02 15:43:33 2021 +0000
+++ b/sys/external/bsd/drm2/drm/files.drmkms    Wed Jun 02 15:45:28 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.drmkms,v 1.34 2020/02/14 04:30:05 riastradh Exp $
+#      $NetBSD: files.drmkms,v 1.35 2021/06/02 15:45:28 nia Exp $
 
 include "external/bsd/drm2/linux/files.drmkms_linux"
 
@@ -12,6 +12,10 @@
 
 defflag                opt_drmkms.h    DRMKMS_DEBUG
 
+# This code comes from the Linux kernel, which assumes signed
+# overflow is OK.
+makeoptions    drmkms  "COPTS.drmkms"+="-fwrapv"
+
 # Overrides first.
 makeoptions    drmkms  CPPFLAGS+="-I$S/external/bsd/drm2/include"
 makeoptions    drmkms_ttm      CPPFLAGS+="-I$S/external/bsd/drm2/include/drm"
diff -r e02442c2792e -r 0f96f1bfedc7 sys/external/bsd/drm2/i915drm/files.i915drmkms
--- a/sys/external/bsd/drm2/i915drm/files.i915drmkms    Wed Jun 02 15:43:33 2021 +0000
+++ b/sys/external/bsd/drm2/i915drm/files.i915drmkms    Wed Jun 02 15:45:28 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.i915drmkms,v 1.40 2021/04/13 04:59:00 mrg Exp $
+#      $NetBSD: files.i915drmkms,v 1.41 2021/06/02 15:45:28 nia Exp $
 
 version        20180827
 
@@ -9,6 +9,10 @@
 device intelfb: intelfbbus, drmfb, drmfb_pci, wsemuldisplaydev
 attach intelfb at intelfbbus
 
+# This code comes from the Linux kernel, which assumes signed
+# overflow is OK.
+makeoptions    i915drmkms      "COPTS.i915drmkms"+="-fwrapv"
+
 makeoptions    i915drmkms      CPPFLAGS+="-I$S/external/bsd/drm2/i915drm"
 
 makeoptions    i915drmkms      CPPFLAGS+="-I$S/external/bsd/drm2/dist/drm/i915"
diff -r e02442c2792e -r 0f96f1bfedc7 sys/external/bsd/drm2/nouveau/files.nouveau
--- a/sys/external/bsd/drm2/nouveau/files.nouveau       Wed Jun 02 15:43:33 2021 +0000
+++ b/sys/external/bsd/drm2/nouveau/files.nouveau       Wed Jun 02 15:45:28 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.nouveau,v 1.29 2020/02/14 04:30:05 riastradh Exp $
+#      $NetBSD: files.nouveau,v 1.30 2021/06/02 15:45:28 nia Exp $
 
 version        20180827
 
@@ -16,6 +16,10 @@
 file   external/bsd/drm2/nouveau/nouveau_vga.c                 nouveau
 file   external/bsd/drm2/nouveau/nouveaufb.c                   nouveaufb
 
+# This code comes from the Linux kernel, which assumes signed
+# overflow is OK.
+makeoptions    nouveau "COPTS.nouveau"+="-fwrapv"
+
 makeoptions    nouveau CPPFLAGS+="-I$S/external/bsd/drm2/dist/drm/nouveau"
 makeoptions    nouveau CPPFLAGS+="-I$S/external/bsd/drm2/dist/drm/nouveau/include"
 makeoptions    nouveau CPPFLAGS+="-I$S/external/bsd/drm2/dist/drm/nouveau/include/nvkm"
diff -r e02442c2792e -r 0f96f1bfedc7 sys/external/bsd/drm2/radeon/files.radeon
--- a/sys/external/bsd/drm2/radeon/files.radeon Wed Jun 02 15:43:33 2021 +0000
+++ b/sys/external/bsd/drm2/radeon/files.radeon Wed Jun 02 15:45:28 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.radeon,v 1.28 2020/02/14 04:30:05 riastradh Exp $
+#      $NetBSD: files.radeon,v 1.29 2021/06/02 15:45:29 nia Exp $
 
 version        20180827
 
@@ -10,6 +10,10 @@
 device radeondrmkmsfb: radeonfbbus, drmfb, drmfb_pci, wsemuldisplaydev
 attach radeondrmkmsfb at radeonfbbus
 
+# This code comes from the Linux kernel, which assumes signed
+# overflow is OK.
+makeoptions    radeon  "COPTS.radeon"+="-fwrapv"
+
 # Our overrides first.
 makeoptions    radeon  CPPFLAGS+="-I$S/external/bsd/drm2/include/radeon"
 makeoptions    radeon  CPPFLAGS+="-I$S/external/bsd/drm2/radeon"



Home | Main Index | Thread Index | Old Index