Skip to content

Fixed linkage in remote_bitbang library#264

Merged
bluewww merged 1 commit intopulp-platform:masterfrom
TobiasFaller:fix-remote-bitbang
Jul 19, 2021
Merged

Fixed linkage in remote_bitbang library#264
bluewww merged 1 commit intopulp-platform:masterfrom
TobiasFaller:fix-remote-bitbang

Conversation

@TobiasFaller
Copy link
Contributor

@TobiasFaller TobiasFaller commented Jul 14, 2021

This pull request fixes the linking of the bitbang library under modern GCC version where the multiple definitions of the global state results in the following error:

#> gcc (Gentoo Hardened 10.3.0 p1) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

#> make all
cc -MT remote_bitbang.o -MMD -MP -MF ./.d/remote_bitbang.Td -std=gnu11 -fno-strict-aliasing -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-function -Wno-missing-braces -O2 -g -march=native -DENABLE_LOGGING -DNDEBUG -fPIC -I./  \
        -c  remote_bitbang.c -o remote_bitbang.o                                                                                                                                              cc -MT sim_jtag.o -MMD -MP -MF ./.d/sim_jtag.Td -std=gnu11 -fno-strict-aliasing -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-function -Wno-missing-braces -O2 -g -march=native -DENABLE_LOGGING -DNDEBUG -fPIC -I./  \
        -c  sim_jtag.c -o sim_jtag.o
ld -shared -E --exclude-libs ALL -o librbs.so  \
        remote_bitbang.o sim_jtag.o
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:25: multiple definition of `recv_end'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:25: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:25: multiple definition of `recv_start'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:25: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:24: multiple definition of `recv_buf'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:24: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:21: multiple definition of `client_fd'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:21: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:20: multiple definition of `socket_fd'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:20: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:18: multiple definition of `quit'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:18: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:17: multiple definition of `tdo'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:17: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:16: multiple definition of `trstn'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:16: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:15: multiple definition of `tdi'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:15: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:14: multiple definition of `tms'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:14: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:13: multiple definition of `tck'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:13: first defined here
ld: sim_jtag.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:11: multiple definition of `rbs_err'; remote_bitbang.o:/root/uni/various/pulpissimo/pulpissimo/rtl/tb/remote_bitbang/remote_bitbang.h:11: first defined here
make: *** [Makefile:87: librbs.so] Error 1

With GCC 9.3.0 the linker ignores the multiple definitions:

#> gcc-9.3.0 --version
gcc-9.3.0 (Gentoo Hardened 9.3.0-r2 p4) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

#> CC=gcc-9.3.0 make all
gcc-9.3.0 -MT remote_bitbang.o -MMD -MP -MF ./.d/remote_bitbang.Td -std=gnu11 -fno-strict-aliasing -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-function -Wno-missing-braces -O2 -g -march=native -DENABLE_LOGGING -DNDEBUG -fPIC -I./  \
        -c  remote_bitbang.c -o remote_bitbang.o
gcc-9.3.0 -MT sim_jtag.o -MMD -MP -MF ./.d/sim_jtag.Td -std=gnu11 -fno-strict-aliasing -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-function -Wno-missing-braces -O2 -g -march=native -DENABLE_LOGGING -DNDEBUG -fPIC -I./  \
        -c  sim_jtag.c -o sim_jtag.o
ld -shared -E --exclude-libs ALL -o librbs.so  \
        remote_bitbang.o sim_jtag.o

@bluewww bluewww linked an issue Jul 14, 2021 that may be closed by this pull request
@bluewww bluewww self-requested a review July 14, 2021 16:44
@bluewww
Copy link
Collaborator

bluewww commented Jul 14, 2021

Thanks for the PR. Sending this through our CI

Copy link
Collaborator

@bluewww bluewww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks

@bluewww bluewww merged commit b1c02cf into pulp-platform:master Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gcc 10 can't compile bitbang

2 participants