Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atomic fallback uses x86 assembler on non-x86 archs #79

Open
barracuda156 opened this issue Sep 9, 2024 · 0 comments
Open

atomic fallback uses x86 assembler on non-x86 archs #79

barracuda156 opened this issue Sep 9, 2024 · 0 comments

Comments

@barracuda156
Copy link

Here is what happens when I build this with gcc-4.2 (an old compiler, but this code only asks for C99, so it is supported by implication) on a non-x86 platform:

mv -f .deps/tcpkali-tcpkali_expr.Tpo .deps/tcpkali-tcpkali_expr.Po
ccache /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I..  -I../deps/libev -I../deps/libcows -I../deps/libstatsd/src -I../deps/HdrHistogram -I../deps/boyer-moore-horspool -I../deps/pcg-c-basic -isystem/opt/local/include/LegacySupport -I/opt/local/include -std=gnu99 -W -Wall -Wno-strict-aliasing -fno-strict-aliasing -pipe -Os -arch ppc -pthread -MT tcpkali-tcpkali.o -MD -MP -MF .deps/tcpkali-tcpkali.Tpo -c -o tcpkali-tcpkali.o `test -f 'tcpkali.c' || echo './'`tcpkali.c
mv -f .deps/tcpkali-tcpkali_expr_y.Tpo .deps/tcpkali-tcpkali_expr_y.Po
In file included from tcpkali_engine.h:33,
                 from tcpkali_statsd.h:34,
                 from tcpkali_statsd.c:33:
tcpkali_traffic_stats.h: In function ‘add_traffic_numbers_AtoN’:
tcpkali_traffic_stats.h:62: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:63: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:64: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:65: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:66: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:67: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
mv -f .deps/tcpkali-tcpkali_statsd.Tpo .deps/tcpkali-tcpkali_statsd.Po
mv -f .deps/tcpkali-tcpkali_expr_l.Tpo .deps/tcpkali-tcpkali_expr_l.Po
In file included from tcpkali_engine.h:33,
                 from tcpkali.h:31,
                 from tcpkali_engine.c:56:
tcpkali_traffic_stats.h: In function ‘add_traffic_numbers_AtoN’:
tcpkali_traffic_stats.h:62: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:63: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:64: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:65: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:66: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:67: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
{standard input}:1182:Invalid mnemonic 'lock'
{standard input}:1185:Invalid mnemonic 'lock'
{standard input}:1188:Invalid mnemonic 'lock'
{standard input}:1192:Invalid mnemonic 'lock'
{standard input}:1196:Invalid mnemonic 'lock'
{standard input}:1200:Invalid mnemonic 'lock'
{standard input}:1311:Invalid mnemonic 'lock'
{standard input}:1391:Invalid mnemonic 'lock'
{standard input}:1394:Invalid mnemonic 'lock'
{standard input}:1397:Invalid mnemonic 'lock'
{standard input}:3824:Invalid mnemonic 'lock'
{standard input}:3828:Invalid mnemonic 'lock'
{standard input}:5526:Invalid mnemonic 'lock'
{standard input}:5948:Invalid mnemonic 'lock'
{standard input}:6011:Invalid mnemonic 'lock'
{standard input}:6053:Invalid mnemonic 'lock'
{standard input}:6186:Invalid mnemonic 'lock'
{standard input}:6190:Invalid mnemonic 'lock'
{standard input}:6298:Invalid mnemonic 'lock'
{standard input}:6380:Invalid mnemonic 'lock'
{standard input}:6407:Invalid mnemonic 'lock'
{standard input}:6421:Invalid mnemonic 'lock'
make[2]: *** [tcpkali-tcpkali_engine.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from tcpkali_engine.h:33,
                 from tcpkali_run.h:33,
                 from tcpkali_run.c:36:
tcpkali_traffic_stats.h: In function ‘add_traffic_numbers_AtoN’:
tcpkali_traffic_stats.h:62: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:63: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:64: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:65: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:66: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:67: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
mv -f .deps/tcpkali-tcpkali_run.Tpo .deps/tcpkali-tcpkali_run.Po
In file included from tcpkali_engine.h:33,
                 from tcpkali.h:31,
                 from tcpkali.c:49:
tcpkali_traffic_stats.h: In function ‘add_traffic_numbers_AtoN’:
tcpkali_traffic_stats.h:62: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:63: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:64: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:65: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:66: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
tcpkali_traffic_stats.h:67: warning: passing argument 1 of ‘atomic_wide_get’ discards qualifiers from pointer target type
mv -f .deps/tcpkali-tcpkali.Tpo .deps/tcpkali-tcpkali.Po
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_tcpkali/tcpkali/work/tcpkali-1.1.1/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_tcpkali/tcpkali/work/tcpkali-1.1.1'
make: *** [all] Error 2

This is because src/tcpkali_atomic.h uses x86 assembler unconditionally in its fallback implementation. This is obviously wrong: if there is no possibility or motivation to have a cross-platform implementation, at least it should fail with a meaningful error message, and preferably already at configure stage.

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

No branches or pull requests

1 participant