Fossil SCM
Add the --with-sanitizer option to the ./configure script.
Commit
231d693314522e0a3b4a170cf2b705dfa992dda10549885427b9a3415fdaefa7
Parent
9bdf650f0b8c0da…
1 file changed
+15
M
auto.def
+15
| --- auto.def | ||
| +++ auto.def | ||
| @@ -9,10 +9,11 @@ | ||
| 9 | 9 | with-zlib:path|auto|tree |
| 10 | 10 | => {Look for zlib in the given path, automatically, or in the source tree} |
| 11 | 11 | with-exec-rel-paths=0 |
| 12 | 12 | => {Enable relative paths for external diff/gdiff} |
| 13 | 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} | |
| 14 | 15 | with-th1-docs=0 => {Enable TH1 for embedded documentation pages} |
| 15 | 16 | with-th1-hooks=0 => {Enable TH1 hooks for commands and web pages} |
| 16 | 17 | with-tcl:path => {Enable Tcl integration, with Tcl in the specified path} |
| 17 | 18 | with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism} |
| 18 | 19 | with-tcl-private-stubs=0 |
| @@ -589,10 +590,24 @@ | ||
| 589 | 590 | define FOSSIL_HAVE_FUSEFS 1 |
| 590 | 591 | define-append LIBS -lfuse |
| 591 | 592 | msg-result "FuseFS support enabled" |
| 592 | 593 | } |
| 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 | +} | |
| 594 | 609 | |
| 595 | 610 | # Finally, append -ldl to make sure it's the last in the list. |
| 596 | 611 | # The library order matters in case of static linking. |
| 597 | 612 | if {[check-function-in-lib dlopen dl]} { |
| 598 | 613 | # Some platforms (*BSD) have the dl functions already in libc and no libdl. |
| 599 | 614 |
| --- 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 |