aboutsummaryrefslogtreecommitdiff
path: root/libctf/swap.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2019-10-16 11:11:28 -0400
committerSimon Marchi <simon.marchi@efficios.com>2019-10-16 11:12:23 -0400
commitcbbbc402e059ee345cb781d3ceb757ae1cc679ee (patch)
tree7ee1bd79039a7d537712ad1567421a794d564fb8 /libctf/swap.h
parentd10eccaa723e31689cdeadaea6bebabe2f63de34 (diff)
downloadgdb-cbbbc402e059ee345cb781d3ceb757ae1cc679ee.zip
gdb-cbbbc402e059ee345cb781d3ceb757ae1cc679ee.tar.gz
gdb-cbbbc402e059ee345cb781d3ceb757ae1cc679ee.tar.bz2
libctf: mark swap.h inline functions as static
When building binutils with mingw-w64, I get the following errors: make[4]: Entering directory '/home/simark/build/binutils-gdb-mingw/binutils' /bin/sh ./libtool --tag=CC --mode=link ccache x86_64-w64-mingw32-gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wno-format -Werror -I/home/simark/src/binutils-gdb/binutils/../zlib -g3 -O0 -D__USE_MINGW_ACCESS -Wl,--stack,12582912 -o objdump.exe objdump.o dwarf.o prdbg.o rddbg.o debug.o stabs.o rdcoff.o bucomm.o version.o filemode.o elfcomm.o ../opcodes/libopcodes.la ../libctf/libctf.la ../bfd/libbfd.la ../libiberty/libiberty.a -lintl libtool: link: ccache x86_64-w64-mingw32-gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wno-format -Werror -I/home/simark/src/binutils-gdb/binutils/../zlib -g3 -O0 -D__USE_MINGW_ACCESS -Wl,--stack -Wl,12582912 -o .libs/objdump.exe objdump.o dwarf.o prdbg.o rddbg.o debug.o stabs.o rdcoff.o bucomm.o version.o filemode.o elfcomm.o ../opcodes/.libs/libopcodes.a ../libctf/.libs/libctf.a -L/home/simark/build/binutils-gdb-mingw/zlib ../bfd/.libs/libbfd.a -lz ../libiberty/libiberty.a -lintl /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o): in function `flip_header': /home/simark/src/binutils-gdb/libctf/ctf-open.c:964: undefined reference to `bswap_16' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:967: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:968: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:969: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:970: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:971: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o):/home/simark/src/binutils-gdb/libctf/ctf-open.c:972: more undefined references to `bswap_32' follow /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o): in function `flip_types': /home/simark/src/binutils-gdb/libctf/ctf-open.c:1112: undefined reference to `bswap_16' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1113: undefined reference to `bswap_16' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1132: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1133: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1134: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1135: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1144: undefined reference to `bswap_32' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o):/home/simark/src/binutils-gdb/libctf/ctf-open.c:1145: more undefined references to `bswap_32' follow /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o): in function `ctf_bufopen_internal': /home/simark/src/binutils-gdb/libctf/ctf-open.c:1342: undefined reference to `bswap_16' /usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open-bfd.o): in function `ctf_fdopen': /home/simark/src/binutils-gdb/libctf/ctf-open-bfd.c:268: undefined reference to `bswap_16' Apparently [1], if we have a function with `inline` but not `static`, there should be a compilation unit defining the symbol too. Alternatively, making those functions `static` fixes that. [1] https://stackoverflow.com/questions/16245521/c99-inline-function-in-c-file/16254679#16254679 libctf/ChangeLog: * swap.h (bswap_16, bswap_32, bswap_64): Make static. Change-Id: I8fd12aedf6c90f9b7418af948e5e0bae0c32eead
Diffstat (limited to 'libctf/swap.h')
-rw-r--r--libctf/swap.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/libctf/swap.h b/libctf/swap.h
index e75e8d4..ac62ac7 100644
--- a/libctf/swap.h
+++ b/libctf/swap.h
@@ -28,13 +28,13 @@
#else
/* Provide our own versions of the byteswap functions. */
-inline uint16_t
+static inline uint16_t
bswap_16 (uint16_t v)
{
return ((v >> 8) & 0xff) | ((v & 0xff) << 8);
}
-inline uint32_t
+static inline uint32_t
bswap_32 (uint32_t v)
{
return ( ((v & 0xff000000) >> 24)
@@ -49,7 +49,7 @@ bswap_identity_64 (uint64_t v)
return v;
}
-inline uint64_t
+static inline uint64_t
bswap_64 (uint64_t v)
{
return ( ((v & 0xff00000000000000ULL) >> 56)