binutils-gdb/libctf
Simon Marchi cbbbc402e0 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
2019-10-16 11:12:23 -04:00
..
ChangeLog libctf: mark swap.h inline functions as static 2019-10-16 11:12:23 -04:00
Makefile.am libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
Makefile.in libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
aclocal.m4 libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
config.h.in libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
configure libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
configure.ac libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
ctf-archive.c libctf: avoid the need to ever use ctf_update 2019-10-03 17:04:56 +01:00
ctf-create.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-decl.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-decls.h libctf: avoid strndup 2019-06-07 13:46:39 +01:00
ctf-dump.c libctf: make ctf_dump not crash on OOM 2019-10-03 17:04:56 +01:00
ctf-endian.h libctf: make it compile for old glibc 2019-10-03 17:04:55 +01:00
ctf-error.c libctf: handle nonrepresentable types at link time 2019-10-03 17:04:56 +01:00
ctf-hash.c libctf: don't leak hash keys or values on value replacement 2019-10-03 17:04:55 +01:00
ctf-impl.h libctf: make ctf_dump not crash on OOM 2019-10-03 17:04:56 +01:00
ctf-labels.c libctf: fix a number of build problems found on Solaris and NetBSD 2019-05-31 11:10:51 +02:00
ctf-link.c libctf: avoid the need to ever use ctf_update 2019-10-03 17:04:56 +01:00
ctf-lookup.c libctf: avoid the need to ever use ctf_update 2019-10-03 17:04:56 +01:00
ctf-open-bfd.c libctf: actually close bfds we have opened 2019-10-03 17:04:55 +01:00
ctf-open.c libctf: fix tabdamage 2019-10-03 17:04:56 +01:00
ctf-qsort_r.c libctf: look for BSD versus GNU qsort_r signatures 2019-06-04 17:05:08 +01:00
ctf-string.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-subr.c libctf: remove ctf_malloc, ctf_free and ctf_strdup 2019-10-03 17:04:56 +01:00
ctf-types.c libctf: fix tabdamage 2019-10-03 17:04:56 +01:00
ctf-util.c libctf: make ctf_dump not crash on OOM 2019-10-03 17:04:56 +01:00
elf.h libctf: low-level list manipulation and helper utilities 2019-05-28 17:07:19 +01:00
libctf.ver libctf: installable libctf as a shared library 2019-10-03 17:04:56 +01:00
swap.h libctf: mark swap.h inline functions as static 2019-10-16 11:12:23 -04:00