Open JPenuchot opened 7 years ago
Doesn't compile on my Ubuntu Azure instance too
cc -c injector.c -o injector.o -Wall
injector.c:321:93: warning: excess elements in array initializer
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
^
injector.c:321:93: note: (near initialization for ‘total_range.start.bytes’)
injector.c:322:91: warning: excess elements in array initializer
.end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},
^
injector.c:322:91: note: (near initialization for ‘total_range.end.bytes’)
cc injector.o -O3 -Wall -l:libcapstone.a -o injector -pthread
Running cc version 5.4.0
Doesn't compile on Ubuntu 17.04.
At first, make fails with:
cc -c injector.c -o injector.o -Wall
injector.c:321:93: warning: excess elements in array initializer
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
^~~~
injector.c:321:93: note: (near initialization for ‘total_range.start.bytes’)
injector.c:322:91: warning: excess elements in array initializer
.end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},
^~~~
injector.c:322:91: note: (near initialization for ‘total_range.end.bytes’)
cc injector.o -O3 -Wall -l:libcapstone.a -o injector -pthread
/usr/bin/ld: injector.o: relocation R_X86_64_32S against undefined symbol `dummy_stack' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:35: recipe for target 'injector' failed
make: *** [injector] Error 1
...so I did make CFLAGS=-fPIC
and got the same output as JPenuchot's report.
gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)
As a workaround, you can use this command to compile it with clang instead, worked on my Ubuntu 17.04:
make CC=clang
Tried with make CC=clang
, got this error (On Solus with clang 4.0.1)
clang -g2 -O3 -pipe -fPIC -Wformat -Wformat-security -fno-omit-frame-pointer -fexceptions -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=32 -fasynchronous-unwind-tables -ftree-vectorize -feliminate-unused-debug-types -Wall -Wno-error -Wp,-D_REENTRANT -c injector.c -o injector.o -Wall
injector.c:321:93: warning: excess elements in array initializer
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
^~~~
injector.c:322:91: warning: excess elements in array initializer
.end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},
^~~~
injector.c:778:24: error: invalid operand for inline asm constraint 'i'
__asm__ __volatile__ ("\
^
2 warnings and 1 error generated.
make: *** [Makefile:38: injector.o] Error 1
I think, it’s something in your CLFAGS
.
$ clang --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ CC=clang make
clang -c injector.c -o injector.o -Wall
injector.c:321:93: warning: excess elements in array initializer
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
^~~~
injector.c:322:91: warning: excess elements in array initializer
.end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},
^~~~
2 warnings generated.
clang injector.o -O3 -Wall -l:libcapstone.a -o injector -pthread
$ make clean
rm *.o injector
$ CLFAGS="-g2 -O3 -pipe -fPIC -Wformat -Wformat-security -fno-omit-frame-pointer -fexceptions -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=32 -fasynchronous-unwind-tables -ftree-vectorize -feliminate-unused-debug-types -Wall -Wno-error -Wp,-D_REENTRANT" CC="clang" make
clang -g2 -O3 -pipe -fPIC -Wformat -Wformat-security -fno-omit-frame-pointer -fexceptions -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=32 -fasynchronous-unwind-tables -ftree-vectorize -feliminate-unused-debug-types -Wall -Wno-error -Wp,-D_REENTRANT -c injector.c -o injector.o -Wall
injector.c:321:93: warning: excess elements in array initializer
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
^~~~
injector.c:322:91: warning: excess elements in array initializer
.end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},
^~~~
injector.c:778:24: error: invalid operand for inline asm constraint 'i'
__asm__ __volatile__ ("\
^
2 warnings and 1 error generated.
make: *** [Makefile:38: injector.o] Error 1
I tried removing one option each time to see from which it could come from but I didn’t find it so it’s probably an error that comes with multiple options.
Doesn't compile on latest Arch Linux either.
injector.c:321:93: warning: excess elements in array initializer
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
^~~~
injector.c:321:93: note: (near initialization for ‘total_range.start.bytes’)
injector.c:322:91: warning: excess elements in array initializer
.end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},
^~~~
injector.c:322:91: note: (near initialization for ‘total_range.end.bytes’)
cc injector.o -O3 -Wall -l:libcapstone.a -o injector -pthread
/usr/bin/ld: injector.o: relocation R_X86_64_32S against undefined symbol `dummy_stack' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make: *** [Makefile:35: injector] Error 1
@MoochMcGee there is an AUR package for sandsifter. https://aur.archlinux.org/packages/sandsifter-git/
for those not on arch, it compiles with -no-pie as an option.
Looks like -no-pie
is unsupported here.
$ make CC=gcc CFLAGS='-no-pie'
gcc -no-pie -c injector.c -o injector.o -Wall
gcc: error: unrecognized command line option ‘-no-pie’
make: *** [Makefile:38: injector.o] Error 1
$ make CC=clang CFLAGS='-no-pie'
clang -no-pie -c injector.c -o injector.o -Wall
clang-4.0: error: unknown argument: '-no-pie'
make: *** [Makefile:38: injector.o] Error 1
$ gcc --version
gcc (Gentoo Hardened 5.4.0-r3 p1.3, pie-0.6.5) 5.4.0
Copyright (C) 2015 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.
$ clang --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
(I’m installing the 5.x branch of Clang/LLVM to see if I’ll be fixed)
Installed capstone from the Git repo, tried to run
make
in the sandsifter folder and got these error messages :Running make version 4.2.1 and CC version 6.4.0