libctf: mark swap.h inline functions as static

Message ID 20191015025025.365312-1-simon.marchi@polymtl.ca
State New
Headers show
Series
  • libctf: mark swap.h inline functions as static
Related show

Commit Message

Simon Marchi Oct. 15, 2019, 2:50 a.m.
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
---
 libctf/swap.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.23.0

Comments

Nick Alcock Oct. 15, 2019, 2:15 p.m. | #1
On 15 Oct 2019, Simon Marchi outgrape:

> 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.


Ugh. I always forget this stuff.

They should definitely be static. (They're not large enough to make
non-staticness worthwhile, I'd say.)

> [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.


I agree with this change.

(... and could anyone review the GDB testsuite fix stuff I've had
outstanding for a few days now? I'm hoping I can push it and the acked
stuff that is first in that patch series before everything changes under
it so much I have to redo it all... :) )
Nick Alcock Oct. 15, 2019, 4:20 p.m. | #2
On 15 Oct 2019, Simon Marchi said:

> When building binutils with mingw-w64, I get the following errors:


I do wonder why I didn't hit this, given that I do test compiles with
mingw64 as well (from cygwin, bcause that's the only way I've found to
both build and test mingw binutils).

Maybe there's another way to do mingw tests-and-crosses, or a version
difference, or something, that's affecting things? I'm about to replace
my ancient crippled mingw test box, but once the new one arrives next
month I'd like to be able to find these things myself so nobody else
needs to be bothered with this sort of fallout.
Jeff Law Oct. 15, 2019, 4:23 p.m. | #3
On 10/15/19 10:20 AM, Nick Alcock wrote:
> On 15 Oct 2019, Simon Marchi said:

> 

>> When building binutils with mingw-w64, I get the following errors:

> 

> I do wonder why I didn't hit this, given that I do test compiles with

> mingw64 as well (from cygwin, bcause that's the only way I've found to

> both build and test mingw binutils).

> 

> Maybe there's another way to do mingw tests-and-crosses, or a version

> difference, or something, that's affecting things? I'm about to replace

> my ancient crippled mingw test box, but once the new one arrives next

> month I'd like to be able to find these things myself so nobody else

> needs to be bothered with this sort of fallout.

> 

The GCC inliner heuristics just changed recently.  That's likely the
triggering event and if you weren't building with gcc-10 trunk you
wouldn't see the change in behavior.

jeff
Nick Alcock Oct. 16, 2019, 12:41 p.m. | #4
On 15 Oct 2019, Jeff Law outgrape:

> On 10/15/19 10:20 AM, Nick Alcock wrote:

>> On 15 Oct 2019, Simon Marchi said:

>> 

>>> When building binutils with mingw-w64, I get the following errors:

>> 

>> I do wonder why I didn't hit this, given that I do test compiles with

>> mingw64 as well (from cygwin, bcause that's the only way I've found to

>> both build and test mingw binutils).

>> 

>> Maybe there's another way to do mingw tests-and-crosses, or a version

>> difference, or something, that's affecting things? I'm about to replace

>> my ancient crippled mingw test box, but once the new one arrives next

>> month I'd like to be able to find these things myself so nobody else

>> needs to be bothered with this sort of fallout.

>> 

> The GCC inliner heuristics just changed recently.  That's likely the

> triggering event and if you weren't building with gcc-10 trunk you

> wouldn't see the change in behavior.


Ah! I was (for the CTF patchset), but only on Linux, not on mingw. I'll
fix that. :)
Simon Marchi Oct. 16, 2019, 3:13 p.m. | #5
On 2019-10-15 10:15 a.m., Nick Alcock wrote:
> On 15 Oct 2019, Simon Marchi outgrape:

> 

>> 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.

> 

> Ugh. I always forget this stuff.

> 

> They should definitely be static. (They're not large enough to make

> non-staticness worthwhile, I'd say.)

> 

>> [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.

> 

> I agree with this change.


Thanks, I pushed it.

> (... and could anyone review the GDB testsuite fix stuff I've had

> outstanding for a few days now? I'm hoping I can push it and the acked

> stuff that is first in that patch series before everything changes under

> it so much I have to redo it all... :) )


It seems like Tom has looked at it now?

Simon
Nick Alcock Oct. 16, 2019, 6:17 p.m. | #6
On 16 Oct 2019, Simon Marchi spake thusly:
> On 2019-10-15 10:15 a.m., Nick Alcock wrote:

>> (... and could anyone review the GDB testsuite fix stuff I've had

>> outstanding for a few days now? I'm hoping I can push it and the acked

>> stuff that is first in that patch series before everything changes under

>> it so much I have to redo it all... :) )

>

> It seems like Tom has looked at it now?


Yes indeed! I'll be posting a revised series shortly (probably later
tonight).

-- 
NULL && (void)
Joey Ye Nov. 1, 2019, 2:59 p.m. | #7
Hi Simon,

I believe bswap_identity_64 need to be changed to static inline as
well. Generally C compilers are not friendly to "inline" keyword
along.

Also may I request backport this and a coming bswap_identity_64 to
2.33 branch please? Without this fix Binutils fails to build with
CFLAGS=-O0 in all platforms.

Thanks,
Joey

On Wed, Oct 16, 2019 at 7:17 PM Nick Alcock <nick.alcock@oracle.com> wrote:
>

> On 16 Oct 2019, Simon Marchi spake thusly:

> > On 2019-10-15 10:15 a.m., Nick Alcock wrote:

> >> (... and could anyone review the GDB testsuite fix stuff I've had

> >> outstanding for a few days now? I'm hoping I can push it and the acked

> >> stuff that is first in that patch series before everything changes under

> >> it so much I have to redo it all... :) )

> >

> > It seems like Tom has looked at it now?

>

> Yes indeed! I'll be posting a revised series shortly (probably later

> tonight).

>

> --

> NULL && (void)
Nick Alcock Nov. 4, 2019, 10:02 a.m. | #8
On 1 Nov 2019, Joey Ye outgrape:

> I believe bswap_identity_64 need to be changed to static inline as

> well. Generally C compilers are not friendly to "inline" keyword

> along.

>

> Also may I request backport this and a coming bswap_identity_64 to

> 2.33 branch please? Without this fix Binutils fails to build with

> CFLAGS=-O0 in all platforms.


Seems like a good idea. Unless someone asks me not to, I'll fold this
extra fix into the things I'm doing to fix bug 25120 (which is taking
way too long: sorry, colliding holidays and trying to get the
deduplicator debugged etc).

Probably next week though :/

Patch

diff --git a/libctf/swap.h b/libctf/swap.h
index e75e8d408a95..ac62ac78d147 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)