Linux Kernels

MIPS: VDSO: Build with `-fno-strict-aliasing'

This change “MIPS: VDSO: Build with `-fno-strict-aliasing'” (commit 94cc36b) in Linux kernel is authored by Maciej W. Rozycki <macro [at]> on Thu May 26 12:55:45 2016 +0100.

Description of "MIPS: VDSO: Build with `-fno-strict-aliasing'"

The change “MIPS: VDSO: Build with `-fno-strict-aliasing'” introduces changes as follows.

MIPS: VDSO: Build with `-fno-strict-aliasing'

Avoid an aliasing issue causing a build error in VDSO:

In file included from include/linux/srcu.h:34:0,
                 from include/linux/notifier.h:15,
                 from ./arch/mips/include/asm/uprobes.h:9,
                 from include/linux/uprobes.h:61,
                 from include/linux/mm_types.h:13,
                 from ./arch/mips/include/asm/vdso.h:14,
                 from arch/mips/vdso/vdso.h:27,
                 from arch/mips/vdso/gettimeofday.c:11:
include/linux/workqueue.h: In function 'work_static':
include/linux/workqueue.h:186:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  return *work_data_bits(work) & WORK_STRUCT_STATIC;
cc1: all warnings being treated as errors
make[2]: *** [arch/mips/vdso/gettimeofday.o] Error 1

with a CONFIG_DEBUG_OBJECTS_WORK configuration and GCC 5.2.0.  Include
`-fno-strict-aliasing' along with compiler options used, as required for
kernel code, fixing a problem present since the introduction of VDSO
with commit ebb5e78cc634 ("MIPS: Initial implementation of a VDSO").

Thanks to Tejun for diagnosing this properly!

Signed-off-by: Maciej W. Rozycki <>
Reviewed-by: James Hogan <>
Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO")
Cc: Tejun Heo <>
Cc: # v4.3+
Signed-off-by: Ralf Baechle <>

Linux kernel releases containing commit 94cc36b

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "MIPS: VDSO: Build with `-fno-strict-aliasing'"

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 arch/mips/vdso/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index b369509e9753..fff01eddf3e9 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -8,7 +8,8 @@ ccflags-vdso := \
 	$(filter -march=%,$(KBUILD_CFLAGS))
 cflags-vdso := $(ccflags-vdso) \
 	$(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
-	-O2 -g -fPIC -fno-common -fno-builtin -G 0 -DDISABLE_BRANCH_PROFILING \
+	-O2 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
 	$(call cc-option, -fno-stack-protector)
 aflags-vdso := $(ccflags-vdso) \
 	$(filter -I%,$(KBUILD_CFLAGS)) \

The commit for this change in Linux stable tree is 94cc36b (patch).

Last modified: 2020/01/11 10:03