SQLite

Check-in [44f2c64ec1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:-fsanitize is a CFLAG, not LDFLAG, so rename some vars accordingly and simplify the feature check to not run the linker.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | flex-array
Files: files | file ages | folders
SHA3-256: 44f2c64ec16f4720dc538be30410863c4138ea4ce41c94521bd7980535261735
User & Date: stephan 2025-03-15 13:50:07.673
Context
2025-03-15
18:26
Fix alignment problems on Linux with -m32 and on Mac PPC. (check-in: 8a91aeca60 user: drh tags: flex-array)
13:50
-fsanitize is a CFLAG, not LDFLAG, so rename some vars accordingly and simplify the feature check to not run the linker. (check-in: 44f2c64ec1 user: stephan tags: flex-array)
13:36
For fuzzcheck-asan, dynamically determine the list of -fsanitize flags to use based on configure-time feature tests. (check-in: b70f9cc815 user: stephan tags: flex-array)
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.in.
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# libsqlite3.out.implib => the output filename part of LDFLAGS_OUT_IMPLIB.
ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@
ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@
HAVE_WASI_SDK = @HAVE_WASI_SDK@
libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@

# -fsanitize flags for the fuzzcheck-asap app
LDFLAGS.fuzzcheck.fsanitize = @LDFLAGS_FUZZCHECK_FSANITIZE@

T.cc.sqlite = $(T.cc) @TARGET_DEBUG@

#
# Define -D_HAVE_SQLITE_CONFIG_H so that the code knows it
# can include the generated sqlite_cfg.h.
#







|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# libsqlite3.out.implib => the output filename part of LDFLAGS_OUT_IMPLIB.
ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@
ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@
HAVE_WASI_SDK = @HAVE_WASI_SDK@
libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@

# -fsanitize flags for the fuzzcheck-asap app
CFLAGS.fuzzcheck.fsanitize = @CFLAGS_FUZZCHECK_FSANITIZE@

T.cc.sqlite = $(T.cc) @TARGET_DEBUG@

#
# Define -D_HAVE_SQLITE_CONFIG_H so that the code knows it
# can include the generated sqlite_cfg.h.
#
Changes to auto.def.
42
43
44
45
46
47
48
49
50
51
52
53
54
    "Use #line macros in the amalgamation:"

  define AMALGAMATION_EXTRA_SRC \
    [join [opt-val amalgamation-extra-src ""] " "]

  define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools]

  define LDFLAGS_FUZZCHECK_FSANITIZE [proj-check-fsanitize {address bounds-strict}]

  sqlite-handle-tcl
  sqlite-handle-emsdk

}







|





42
43
44
45
46
47
48
49
50
51
52
53
54
    "Use #line macros in the amalgamation:"

  define AMALGAMATION_EXTRA_SRC \
    [join [opt-val amalgamation-extra-src ""] " "]

  define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools]

  define CFLAGS_FUZZCHECK_FSANITIZE [proj-check-fsanitize {address bounds-strict}]

  sqlite-handle-tcl
  sqlite-handle-emsdk

}
Changes to autosetup/proj.tcl.
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052

########################################################################
# @proj-check-fsanitize ?list-of-opts?
#
# Checks whether CC supports -fsanitize=X, where X is each entry of
# the given list of flags. If any of those flags are supported, it
# returns the string "-fsanitize=X..." where X... is a comma-separated
# list of all flags which passed. If none of the given options are
# supported then it returns an empty string.
proc proj-check-fsanitize {{opts {address bounds-strict}}} {
  set sup {}
  foreach opt $opts {
    cc-with {-link 1} {
      if {[cc-check-flags "-fsanitize=$opt"]} {
        lappend sup $opt
      }
    }
  }
  if {[llength $sup] > 0} {
    return "-fsanitize=[join $sup ,]"







|




|







1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052

########################################################################
# @proj-check-fsanitize ?list-of-opts?
#
# Checks whether CC supports -fsanitize=X, where X is each entry of
# the given list of flags. If any of those flags are supported, it
# returns the string "-fsanitize=X..." where X... is a comma-separated
# list of all supported flags. If none of the given options are
# supported then it returns an empty string.
proc proj-check-fsanitize {{opts {address bounds-strict}}} {
  set sup {}
  foreach opt $opts {
    cc-with {} {
      if {[cc-check-flags "-fsanitize=$opt"]} {
        lappend sup $opt
      }
    }
  }
  if {[llength $sup] > 0} {
    return "-fsanitize=[join $sup ,]"
Changes to main.mk.
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182

fuzzcheck$(T.exe):	$(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
	$(T.link) -o $@ $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(LDFLAGS.libsqlite3)
fuzzy: fuzzcheck$(T.exe)
xbin: fuzzcheck$(T.exe)

# -fsanitize=... flags for fuzzcheck-asan.
LDFLAGS.fuzzcheck.fsanitize ?= -fsanitize=address

fuzzcheck-asan$(T.exe):	$(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
	$(T.link) -o $@ $(LDFLAGS.fuzzcheck.fsanitize) $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) \
		sqlite3.c $(LDFLAGS.libsqlite3)
fuzzy: fuzzcheck-asan$(T.exe)
xbin: fuzzcheck-asan$(T.exe)

fuzzcheck-ubsan$(T.exe):	$(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
	$(T.link) -o $@ -fsanitize=undefined $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) \
		sqlite3.c $(LDFLAGS.libsqlite3)







|


|







2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182

fuzzcheck$(T.exe):	$(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
	$(T.link) -o $@ $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(LDFLAGS.libsqlite3)
fuzzy: fuzzcheck$(T.exe)
xbin: fuzzcheck$(T.exe)

# -fsanitize=... flags for fuzzcheck-asan.
CFLAGS.fuzzcheck.fsanitize ?= -fsanitize=address

fuzzcheck-asan$(T.exe):	$(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
	$(T.link) -o $@ $(CFLAGS.fuzzcheck.fsanitize) $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) \
		sqlite3.c $(LDFLAGS.libsqlite3)
fuzzy: fuzzcheck-asan$(T.exe)
xbin: fuzzcheck-asan$(T.exe)

fuzzcheck-ubsan$(T.exe):	$(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP)
	$(T.link) -o $@ -fsanitize=undefined $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) \
		sqlite3.c $(LDFLAGS.libsqlite3)