Commit Graph

340 Commits

Author SHA1 Message Date
Daniel Verkamp
f9193f4ce7 json: add JSON parser and encoder libraries
Change-Id: Id73fb7e300d66d31a7c3986c0334b6f56e284905
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-09 13:30:02 -07:00
Daniel Verkamp
3a94688d8e build: add spdk.lib.mk for common library rules
Change-Id: I0547554c010b0eaa6e98c843e7d9eb78c90f76d5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-09 11:24:58 -07:00
Jim Harris
d05669cef4 build: prepare spdk.common.mk for building C++ files
1) -Wstrict-prototypes applies to C code only
2) add CXXFLAGS definition

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I440702d989c4e89bd297956a58725f62d2d72831
2016-03-25 04:31:32 -07:00
Daniel Verkamp
55d9ff6a66 config: make -Werror optional and off by default
Allow end users to build the code even if, for example, warnings are
added with new compilers versions.

-Werror is still enforced for automated builds.

Change-Id: I567009d55cf5b941c452bd41d09f75d03b037209
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-18 10:42:28 -07:00
Daniel Verkamp
7198a4701a build: don't print subdir banners
Since the individual build steps include the path now, the subdirectory
printouts are less useful (especially with parallel make, where output
from multiple subdirs gets mixed together).

Change-Id: Ied71d39b360b847ca32ccd3547def751ddd9434c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 08:15:42 -07:00
Daniel Verkamp
d6540ae907 build: don't print top-level directory
For example, if the source code is located in a directory called "spdk",
don't print the "spdk/" prefix on all of the directories.

Change-Id: I9adc650b13e013773450c721c8434c6e5afeecc2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-08 10:59:56 -07:00
Daniel Verkamp
bafbc89d3a build: print path in CC, LINK, and LIB messages
This makes it somewhat clearer what is happening during parallel
builds (make -j).

Change-Id: Ibbe8862da7600e784cba64cd333086f1473455ac
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-08 10:43:29 -07:00
Daniel Verkamp
4cb05719bd build: add config option to use Address Sanitizer
Change-Id: I98bf4ab1c58a90341c2a8529de4537fb0250f00d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-23 16:41:31 -07:00
Ziye Yang
ff6125195c SPDK: Support configuring libpciaccess library
With CONFIG_PCIACCESS=y in CONFIG file, we can
use libpciaccess library; With CONFIG_PCIACCESS=n
in CONFIG file, we use pciaccess functions provided
in DPDK.

Change-Id: I786c5589b8e7909ba2e59d222938dd5ba45bf92d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-02-04 17:30:09 -07:00
Daniel Verkamp
c02b179490 Remove year from copyright headers.
Also add a space between Copyright and (c).

The copyright year can be determined using git metadata.

Also remove the duplicated "All rights reserved." - every instance of
this line already has a corresponding "All rights reserved" immediately
below it, except for examples/ioat/kperf/kmod/dma_perf.c, where I have
added it manually.

Performed using this command:

git ls-files | xargs sed -i -e 's/Copyright(c) \(.*\) Intel Corporation. All rights reserved./Copyright (c) Intel Corporation./'

Change-Id: I3779f404966800709024eb1eb66a50068af2716c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-28 08:54:18 -07:00
Daniel Verkamp
5f844a0477 nvme/utest: add SPDK_CU_ASSERT_FATAL wrapper
The normal CU_ASSERT_FATAL macro calls a function that is not marked as
noreturn, so static analyzers (e.g. scan-buid) can't figure out that
fatal asserts are really fatal.

Add a wrapper macro that calls abort(), which the analyzer can determine
does not return.

Change-Id: I0c087bf9c8d3c272bf88120caa70e87dab6d9546
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-08 09:31:10 -07:00
Daniel Verkamp
7ab7984885 build: undefine _FORTIFY_SOURCE before setting it
Some compilers automatically define _FORTIFY_SOURCE to a different
value, so undefine it before setting it on the compiler command line.

Change-Id: Id662953bd4466b99d0fe9bd5bb96f9fc335ff9a8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-12-22 10:15:06 -07:00
Daniel Verkamp
d4ab30ba33 ioat: add user-mode Intel I/OAT driver
The ioat driver supports DMA engine copy offload hardware available on
Intel Xeon platforms.

Change-Id: Ida0b17b25816576948ddb1b0443587e0f09574d4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-12-09 10:14:15 -07:00
Daniel Verkamp
01b48b7c90 build: define a common Makefile clean command
Use $(CLEAN_C) throughout the Makefiles to clean up a consistent set of
generated files.

This also adds coverage files to the list of cleaned files.

Change-Id: Iceb922935a45c9eecbf2f3443bd0ee4f5c966825
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-12-07 15:14:36 -07:00
Ben Walker
af2a731de3 build: Allow relative path for DPDK_DIR
This is very convenient. It also works from subdirectories, as
long as you adjust the relative path you pass appropriately.

Change-Id: I8cfeac380ccb5fad4389ee1feb838f986a837f11
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2015-12-07 14:08:28 -07:00
Jim Harris
38ea764f6d Conditionally add -lrte_malloc.
librte_malloc has been deprecated by DPDK, but to allow for backwards
compability, check for its existence and link with it if it exists.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3e05a3295b6768bd6804a8ec86c301e22040df37
2015-11-30 08:54:39 -07:00
Daniel Verkamp
1c3b08c63c build: move $(OBJS) definition to spdk.common.mk
Change-Id: I2dd592269ef644cfe73921151b9b174dc255323d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:55 -07:00
Daniel Verkamp
3d988d287a build: use $(APP) target consistently
Replace $(UT_APP) in nvme.unittest.mk with $(APP); there is no actual
difference in the way they are used.

Change-Id: I039c2488ee998ee8b1a67af129045b66a97bc29c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:54 -07:00
Daniel Verkamp
dba4829471 build: factor out common compile and link commands
Add common $(COMPILE_C), $(LINK_C), and $(LIB_C) variables that contain
the commands to build a .o from a .c, an app from objects and libraries,
and a library from objects, respectively.

Change-Id: Ie2eaa13156b8bf3db7a4ffa66161382d829aef07
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:54 -07:00
Daniel Verkamp
9ea5194634 build: simplify dependency generation
Modern GCC and Clang versions can generate .d files without needing the
complex sequence of sed scripts that we currently use.

Also adjust the .o rule so the .d file is regenerated if it gets
deleted.

Also make the .o depend on all of the Makefile fragments in
$(MAKEFILE_LIST) so that it is rebuilt if the Makefile is changed.

Change-Id: I44e186c0f34dabfa0cf35db1ffa66b84d9dae87d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-10 14:40:22 -07:00
Daniel Verkamp
7cb4463dc5 build: use -std=gnu99 rather than -std=gnu11
We don't use any C11-specific features, and switching to C99 will allow
us to support older versions of GCC.

In particular, the version of GCC used by Travis CI is too old to
support -std=gnu11.

Change-Id: Id5bd8351fdd83e7f4b6703048a921c78c3f06ec6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-04 14:39:38 -07:00
Daniel Verkamp
afed5ba9da build: disable missing field initializer warning
This partially reverts commit fd93c1b1ef.

Older versions of GCC don't consider the empty initializer to be
acceptable when this warning is turned on.

Change-Id: I5c1c22ca988f464990c68eb56e4dd4d51cb99410
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 19:47:34 -07:00
Daniel Verkamp
2e03f6fe1c build: enable strict prototypes warning
This catches functions with empty parameter lists, which are not the
same as void parameter lists in C, as well as other (less-likely)
K&R-style parameter lists.

Change-Id: I18b09e01a60b3669d1cc5d8d96eec20cd872c497
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 16:05:06 -07:00
Daniel Verkamp
8307eb5f55 build: enable missing function declaration warning
This helps weed out functions that should be static, functions that are
not declared in public header files, and .c files that don't include
their .h interface headers.

Change-Id: Ie39f83ad4b320847e4a938bd1d4d0b4fa21c2ffa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:23 -07:00
Daniel Verkamp
e9fa656027 build: enable -Wextra except -Wunused-parameter
-Wold-style-declaration, -Wsign-compare, and
-Wmissing-field-initializers are included in -Wextra.

-Wunused-parameter is not very useful, so disable that explicitly, but
enable the rest of -Wextra.

Change-Id: I034b368d16306544e0eadafab9ec1ccf27f21645
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:22 -07:00
Daniel Verkamp
fd93c1b1ef build: enable missing field initializer warning
Replace {0} initializers with {}, since it is equivalent and simpler
(and avoids the warning).

Change-Id: Id2014a352e2c627598cd3b4f1ca04dba35f2dc3a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:22 -07:00
Daniel Verkamp
a945f60c79 build: enable signed-vs-unsigned compare warning
Change-Id: I93f069241cb74b3ec7d272bc390998372c376b16
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:22 -07:00
Daniel Verkamp
497d40b19b build: add CONFIG_COVERAGE code coverage option
Collect coverage information for use with gcov.

Coverage is disabled on FreeBSD because the current version of clang
provided by FreeBSD can't successfully link with -ftest-coverage enabled
(the compiler-rt support libs are too old).

Change-Id: Icc444936caa852bfb9a02b37223209319a27a770
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:49 -07:00
Daniel Verkamp
c9cc869a3e nvme/perf: add Linux libaio benchmarking support
This allows comparing the Linux kernel driver's performance to the SPDK
user-mode NVMe driver.

Change-Id: I71c70163a4133c2f237c8c57b3c698ec261455f5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-26 11:16:57 -07:00
Daniel Verkamp
3adea82331 build: always build with -fPIC
This allows the same objects to be linked into static and shared
libraries and allows the creation of position-independent executables
with the static libraries.

Change-Id: I119949c3644c02a83e414227615dcc2d8f896286
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-13 10:12:54 -07:00
Daniel Verkamp
557f3bd6c2 build: enable -fstack-protector
Change-Id: I2ba23c48ee8b9048022cff6cc861e990fd1ff570
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-13 10:04:04 -07:00
Daniel Verkamp
3a2b871a41 build: enable printf format warnings
Some of these are covered under -Wall, but add them all just to be clear.

Change-Id: I63104be4bf58becd19a4c30a4d275d2c24c6761d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-12 16:41:55 -07:00
Daniel Verkamp
28b4b01136 build: enable noexecstack
Modern toolchains already enable noexecstack by default, but set it
explicitly just to be sure.

Change-Id: I2866220db5a5ed0bb6e78a4e83763839ea3b93b0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-12 16:41:54 -07:00
Daniel Verkamp
ed3b72fba9 build: enable _FORTIFY_SOURCE=2 for release builds
Change-Id: I61a0700c2ee6e22cdde6e6cc8c491a1e52043136
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-12 16:41:54 -07:00
Daniel Verkamp
92a7dba668 build: enable full RELRO in LDFLAGS
This forces the ELF loader to resolve all relocations immediately at
load time rather than allowing lazy binding.

Therefore the loader can make the GOT (global offset table) read-only
once the relocations are complete during the loading process.

Change-Id: I89a878d1060ce79d58c5be7700d8b122a33a8ceb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-12 16:41:54 -07:00
Jim Harris
1d90157262 Fix header file dependencies.
Move dependency includes into a new spdk.deps.mk file,
then include it at the end of Makefiles that build
source files.

Also add a test to autobuild.sh to confirm that
binaries are regenerated if we make after touching a
header file.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If6a1905706a840f92cbdf3ace7fbdb27fe2de213
2015-09-28 09:07:04 -07:00
Daniel Verkamp
f19d1faedd build: disable assert() when building for release
Set -DNDEBUG to make assert() a no-op.  Since nvme_assert() is just an
alias for assert(), this controls compilation of nvme_assert as well.

Change-Id: Ie9d0c7fea007eff030179c1b54865adc3dcaf6b6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-25 14:22:49 -07:00
Jim Harris
068b20abab build: add OS to spdk.common.mk
This will add different flags, src files, etc. for FreeBSD.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4f2d664cf42d01745318f241ce9558dccf148b7d
2015-09-25 09:36:43 -07:00
Daniel Verkamp
9a96ff3b9b nvme/test: build unit tests using common CFLAGS
Inherit the CFLAGS and other common setup from spdk.common.mk instead of
redefining it in nvme.unittest.mk.

In particular, this enables warnings for the unit test code that were
not enabled before.

Change-Id: Id0fbf0ee0b0d63f9de0c362d1d23e2bd036a7145
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-24 10:48:46 -07:00
Daniel Verkamp
1010fb3af1 SPDK: Initial check-in
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-21 08:52:41 -07:00