Thank you Edmund, but it does not work (see below).
Btw, do you know that can ask for an account on GCC Compile Farm Project (see: https://gcc.gnu.org/wiki/CompileFarm) Here you can have remote access on different machines for free. Among them you have: name port disk CPU Notes gcc113 500GB 8x2.4 GHz aarch64 / 32 GB RAM / APM X-Gene Mustang board / Ubuntu 14.04.3 LTS gcc114 500GB 8x2.4 GHz aarch64 / 32 GB RAM / APM X-Gene Mustang board / Ubuntu 14.04.3 LTS gcc115 500GB 8x2.4 GHz aarch64 / 32 GB RAM / APM X-Gene Mustang board / Ubuntu 14.04.3 LTS gcc116 500GB 8x2.4 GHz aarch64 / 32 GB RAM / APM X-Gene Mustang board / Ubuntu 14.04.3 LTS This is where I tested: jullien@gcc113:~/tinycc$ more config.h /* Automatically generated by configure - do not modify */ #ifndef CONFIG_TCCDIR # define CONFIG_TCCDIR "/usr/local/lib/tcc" #endif #define GCC_MAJOR 4 #define GCC_MINOR 8 #define TCC_VERSION "0.9.26" jullien@gcc113:~/tinycc$ export LD_LIBRARY_PATH=/usr/local/lib/tcc jullien@gcc113:~/tinycc$ ./configure Binary directory /usr/local/bin TinyCC directory /usr/local/lib/tcc Library directory /usr/local/lib Include directory /usr/local/include Manual directory /usr/local/share/man Info directory /usr/local/share/info Doc directory /usr/local/share/doc Target root prefix Source path /home/jullien/tinycc C compiler gcc Target OS Linux CPU aarch64 Big Endian no gprof enabled no cross compilers no use libgcc no Creating config.mak and config.h config.h is unchanged jullien@gcc113:~/tinycc$ make gcc -o tcc.o -c tcc.c -DCONFIG_LDDIR="\"lib\"" -DCONFIG_MULTIARCHDIR="\"aarch64- linux-gnu\"" -DTCC_TARGET_ARM64 -Wall -g -O2 -Wdeclaration-after-statement -Wno- deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. gcc -o libtcc.o -c libtcc.c -DCONFIG_LDDIR="\"lib\"" -DCONFIG_MULTIARCHDIR="\"aa rch64-linux-gnu\"" -DTCC_TARGET_ARM64 -Wall -g -O2 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-c ompare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. gcc -o tccpp.o -c tccpp.c -DCONFIG_LDDIR="\"lib\"" -DCONFIG_MULTIARCHDIR="\"aarc h64-linux-gnu\"" -DTCC_TARGET_ARM64 -Wall -g -O2 -Wdeclaration-after-statement - Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-com pare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. gcc -o tccgen.o -c tccgen.c -DCONFIG_LDDIR="\"lib\"" -DCONFIG_MULTIARCHDIR="\"aa rch64-linux-gnu\"" -DTCC_TARGET_ARM64 -Wall -g -O2 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-c ompare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. gcc -o tccelf.o -c tccelf.c -DCONFIG_LDDIR="\"lib\"" -DCONFIG_MULTIARCHDIR="\"aa rch64-linux-gnu\"" -DTCC_TARGET_ARM64 -Wall -g -O2 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-c ompare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. gcc -o tccasm.o -c tccasm.c -DCONFIG_LDDIR="\"lib\"" -DCONFIG_MULTIARCHDIR="\"aa rch64-linux-gnu\"" -DTCC_TARGET_ARM64 -Wall -g -O2 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-c ompare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. gcc -o tccrun.o -c tccrun.c -DCONFIG_LDDIR="\"lib\"" -DCONFIG_MULTIARCHDIR="\"aa rch64-linux-gnu\"" -DTCC_TARGET_ARM64 -Wall -g -O2 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-c ompare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. gcc -o arm64-gen.o -c arm64-gen.c -DCONFIG_LDDIR="\"lib\"" -DCONFIG_MULTIARCHDIR ="\"aarch64-linux-gnu\"" -DTCC_TARGET_ARM64 -Wall -g -O2 -Wdeclaration-after-sta tement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno- sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing -I. ar rcs libtcc.a libtcc.o tccpp.o tccgen.o tccelf.o tccasm.o tccrun.o arm64-gen.o gcc -o tcc tcc.o libtcc.a -Wall -g -O2 -Wdeclaration-after-statement -Wno-deprec ated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno- unused-result -Wno-uninitialized -fno-strict-aliasing -I. -lm -ldl make -C lib native make[1]: Entering directory `/home/jullien/tinycc/lib' ar rcs ../libtcc1.a arm64/lib-arm64.o make[1]: Leaving directory `/home/jullien/tinycc/lib' jullien@gcc113:~/tinycc$ make test make -C tests make[1]: Entering directory `/home/jullien/tinycc/tests' ------------ hello-exe ------------ ../tcc -B.. -I../include -I.. -I.. ../examples/ex1.c -o hello || (../tcc -vv; ex it 1) && ./hello Hello World ------------ hello-run ------------ ../tcc -B.. -I../include -I.. -I.. -run ../examples/ex1.c Hello World gcc -o libtcc_test libtcc_test.c ../libtcc.a -I.. -I.. -lm -ldl ------------ libtest ------------ ./libtcc_test -B.. -I../include -I.. -I.. tcc: error: R_AARCH64_(JUMP|CALL)26 relocation failed (val=27c4e7cc, addr=401b10 ) make[1]: *** [libtest] Error 1 -----Original Message----- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Edmund Grimley Evans Sent: lundi 10 octobre 2016 22:18 To: tinycc-devel@nongnu.org Subject: [Tinycc-devel] PATCH: Use R_AARCH64_MOVW_UABS_G* instead of R_AARCH64_CALL26. I'll push this in about 24 hours if nobody objects. TCC might work on the "APM X-Gene Mustang board / Ubuntu 14.04.3 LTS" with this. Use R_AARCH64_MOVW_UABS_G* instead of R_AARCH64_CALL26. This is a work-around for TCC's linker not building a PLT when TCC is invoked with "-run". diff --git a/arm64-gen.c b/arm64-gen.c index f9f9581..5f52e1f 100644 --- a/arm64-gen.c +++ b/arm64-gen.c @@ -592,13 +592,22 @@ ST_FUNC void store(int r, SValue *sv) static void arm64_gen_bl_or_b(int b) { + // Currently TCC's linker does not generate a PLT when TCC is invoked + // with "-run". This means functions can be out of range if we try to + // call them in the usual way. Until the linker is fixed, work around + // this by using R_AARCH64_MOVW_UABS_G* relocations; see arm64_sym. + int avoid_call26 = 1; + if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { - assert(!b); - if (vtop->r & VT_SYM) + assert(!b && (vtop->r & VT_SYM)); + if (avoid_call26) { + arm64_sym(30, vtop->sym, 0); + o(0xd63f03c0); // blr x30 + } + else { greloc(cur_text_section, vtop->sym, ind, R_AARCH64_CALL26); - else - assert(0); - o(0x94000000); // bl . + o(0x94000000); // bl . + } } else o(0xd61f0000 | (uint32_t)!b << 21 | intr(gv(RC_R30)) << 5); // br/blr _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel