All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2,1/1] libcorrect: fix debug build
@ 2018-11-20 17:59 Fabrice Fontaine
  2018-11-20 22:12 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2018-11-20 17:59 UTC (permalink / raw)
  To: buildroot

Add a patch to use -fsanitize=address only when available

Fixes:
 - http://autobuild.buildroot.net/results/221d6a418e75b39fe645c3a56cee676518d2cff6

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
 - Add a patch instead of using Release target

 ...s.txt-conditionally-use-fsanitize-address.patch | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 package/libcorrect/0002-CMakeLists.txt-conditionally-use-fsanitize-address.patch

diff --git a/package/libcorrect/0002-CMakeLists.txt-conditionally-use-fsanitize-address.patch b/package/libcorrect/0002-CMakeLists.txt-conditionally-use-fsanitize-address.patch
new file mode 100644
index 0000000000..82e4f13e66
--- /dev/null
+++ b/package/libcorrect/0002-CMakeLists.txt-conditionally-use-fsanitize-address.patch
@@ -0,0 +1,35 @@
+From 1a3bb66608b2f96407d14fe13b782626990060f1 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Tue, 20 Nov 2018 08:20:13 +0100
+Subject: [PATCH] CMakeLists.txt: conditionally use -fsanitize=address
+
+Check that compiler supports -fsanitize=address before using it
+
+Fixes:
+ - http://autobuild.buildroot.net/results/221d6a418e75b39fe645c3a56cee676518d2cff6
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ CMakeLists.txt | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2e8e07e..c3f71ce 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -17,7 +17,11 @@ if(COMPILER_SUPPORTS_WPEDANTIC)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")
+ endif()
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3 -O0 -fsanitize=address")
++    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3 -O0")
++    check_c_compiler_flag("-fsanitize=address -Werror" COMPILER_SUPPORTS_SANITIZE_ADDRESS)
++    if(COMPILER_SUPPORTS_SANITIZE_ADDRESS)
++        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
++    endif()
+     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie,")
+ else()
+   if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+-- 
+2.14.1
+
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH v2,1/1] libcorrect: fix debug build
  2018-11-20 17:59 [Buildroot] [PATCH v2,1/1] libcorrect: fix debug build Fabrice Fontaine
@ 2018-11-20 22:12 ` Peter Korsgaard
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2018-11-20 22:12 UTC (permalink / raw)
  To: buildroot

>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > Add a patch to use -fsanitize=address only when available
 > Fixes:
 >  - http://autobuild.buildroot.net/results/221d6a418e75b39fe645c3a56cee676518d2cff6

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
 > ---
 > Changes v1 -> v2 (after review of Thomas Petazzoni):
 >  - Add a patch instead of using Release target

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-20 22:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-20 17:59 [Buildroot] [PATCH v2,1/1] libcorrect: fix debug build Fabrice Fontaine
2018-11-20 22:12 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.