Fossil SCM

Add the --with-sanitizer option to the ./configure script.

drh 2019-08-20 14:55 trunk merge
Commit 231d693314522e0a3b4a170cf2b705dfa992dda10549885427b9a3415fdaefa7
1 file changed +15
+15
--- auto.def
+++ auto.def
@@ -9,10 +9,11 @@
99
with-zlib:path|auto|tree
1010
=> {Look for zlib in the given path, automatically, or in the source tree}
1111
with-exec-rel-paths=0
1212
=> {Enable relative paths for external diff/gdiff}
1313
with-legacy-mv-rm=1 => {Enable legacy behavior for mv/rm (skip checkout files)}
14
+ with-sanitizer: => {Build with C compiler's -fsanitize=LIST; e.g. address,enum,null,undefined}
1415
with-th1-docs=0 => {Enable TH1 for embedded documentation pages}
1516
with-th1-hooks=0 => {Enable TH1 hooks for commands and web pages}
1617
with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
1718
with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism}
1819
with-tcl-private-stubs=0
@@ -589,10 +590,24 @@
589590
define FOSSIL_HAVE_FUSEFS 1
590591
define-append LIBS -lfuse
591592
msg-result "FuseFS support enabled"
592593
}
593594
}
595
+
596
+# Add -fsanitize compile and link options late: we don't want the C
597
+# checks above to run with those sanitizers enabled. It can not only
598
+# be pointless, it can actually break correct tests.
599
+set fsan [opt-val with-sanitizer]
600
+if {[string length $fsan]} {
601
+ define-append EXTRA_CFLAGS -fsanitize=$fsan
602
+ define-append EXTRA_LDFLAGS -fsanitize=$fsan
603
+ if {[string first "undefined" $fsan] != -1} {
604
+ # We need to link with libubsan if we're compiling under
605
+ # GCC with -fsanitize=undefined.
606
+ cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
607
+ }
608
+}
594609
595610
# Finally, append -ldl to make sure it's the last in the list.
596611
# The library order matters in case of static linking.
597612
if {[check-function-in-lib dlopen dl]} {
598613
# Some platforms (*BSD) have the dl functions already in libc and no libdl.
599614
--- auto.def
+++ auto.def
@@ -9,10 +9,11 @@
9 with-zlib:path|auto|tree
10 => {Look for zlib in the given path, automatically, or in the source tree}
11 with-exec-rel-paths=0
12 => {Enable relative paths for external diff/gdiff}
13 with-legacy-mv-rm=1 => {Enable legacy behavior for mv/rm (skip checkout files)}
 
14 with-th1-docs=0 => {Enable TH1 for embedded documentation pages}
15 with-th1-hooks=0 => {Enable TH1 hooks for commands and web pages}
16 with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
17 with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism}
18 with-tcl-private-stubs=0
@@ -589,10 +590,24 @@
589 define FOSSIL_HAVE_FUSEFS 1
590 define-append LIBS -lfuse
591 msg-result "FuseFS support enabled"
592 }
593 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
595 # Finally, append -ldl to make sure it's the last in the list.
596 # The library order matters in case of static linking.
597 if {[check-function-in-lib dlopen dl]} {
598 # Some platforms (*BSD) have the dl functions already in libc and no libdl.
599
--- auto.def
+++ auto.def
@@ -9,10 +9,11 @@
9 with-zlib:path|auto|tree
10 => {Look for zlib in the given path, automatically, or in the source tree}
11 with-exec-rel-paths=0
12 => {Enable relative paths for external diff/gdiff}
13 with-legacy-mv-rm=1 => {Enable legacy behavior for mv/rm (skip checkout files)}
14 with-sanitizer: => {Build with C compiler's -fsanitize=LIST; e.g. address,enum,null,undefined}
15 with-th1-docs=0 => {Enable TH1 for embedded documentation pages}
16 with-th1-hooks=0 => {Enable TH1 hooks for commands and web pages}
17 with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
18 with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism}
19 with-tcl-private-stubs=0
@@ -589,10 +590,24 @@
590 define FOSSIL_HAVE_FUSEFS 1
591 define-append LIBS -lfuse
592 msg-result "FuseFS support enabled"
593 }
594 }
595
596 # Add -fsanitize compile and link options late: we don't want the C
597 # checks above to run with those sanitizers enabled. It can not only
598 # be pointless, it can actually break correct tests.
599 set fsan [opt-val with-sanitizer]
600 if {[string length $fsan]} {
601 define-append EXTRA_CFLAGS -fsanitize=$fsan
602 define-append EXTRA_LDFLAGS -fsanitize=$fsan
603 if {[string first "undefined" $fsan] != -1} {
604 # We need to link with libubsan if we're compiling under
605 # GCC with -fsanitize=undefined.
606 cc-check-function-in-lib __ubsan_handle_add_overflow ubsan
607 }
608 }
609
610 # Finally, append -ldl to make sure it's the last in the list.
611 # The library order matters in case of static linking.
612 if {[check-function-in-lib dlopen dl]} {
613 # Some platforms (*BSD) have the dl functions already in libc and no libdl.
614

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button