Package: tcc
Version: 0.9.26~git20120104.83d57c0-4
Severity: wishlist
Tags: upstream patch
tcc should support the -rpath option, as it is generated by libtool
(e.g. to be able to build the MPFR tests with shared libraries
enabled). The attached patch does that (please review it, as I am
not familiar with the tcc code).
The patch itself seems to work on my x86_64 machine (though running
the test is another problem...). At least its behavior is equivalent
to -Wl,-rpath.
Note that it does not free the memory explicitly when the program
ends. I don't think this is a problem in practice, except when
testing with tools like valgrind.
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1,
'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages tcc depends on:
ii dpkg 1.16.1.2
ii install-info 4.13a.dfsg.1-8
ii libc6 2.13-27
Versions of packages tcc recommends:
ii libc6-dev [libc-dev] 2.13-27
tcc suggests no packages.
-- no debconf information
--- a/tcc.c 2012-01-04 14:40:03.000000000 +0100
+++ b/tcc.c 2012-03-12 16:08:59.000000000 +0100
@@ -67,6 +67,7 @@
" -soname set name for shared library to be used at runtime\n"
" -static static linking\n"
" -rdynamic export all global symbols to dynamic linker\n"
+ " -rpath set custom library search path\n"
" -r generate (relocatable) object file\n"
"Debugger options:\n"
" -g generate runtime debug info\n"
@@ -104,6 +105,7 @@
TCC_OPTION_static,
TCC_OPTION_shared,
TCC_OPTION_soname,
+ TCC_OPTION_rpath,
TCC_OPTION_o,
TCC_OPTION_r,
TCC_OPTION_s,
@@ -151,6 +153,7 @@
{ "static", TCC_OPTION_static, 0 },
{ "shared", TCC_OPTION_shared, 0 },
{ "soname", TCC_OPTION_soname, TCC_OPTION_HAS_ARG },
+ { "rpath", TCC_OPTION_rpath, TCC_OPTION_HAS_ARG },
{ "o", TCC_OPTION_o, TCC_OPTION_HAS_ARG },
{ "pedantic", TCC_OPTION_pedantic, 0},
{ "pthread", TCC_OPTION_pthread, 0},
@@ -441,6 +444,19 @@
case TCC_OPTION_rdynamic:
s->rdynamic = 1;
break;
+ case TCC_OPTION_rpath:
+ {
+ char *arg;
+ int len;
+ len = strlen(optarg);
+ arg = tcc_malloc(len + 8);
+ memcpy(arg, "-rpath=", 7);
+ memcpy(arg + 7, optarg, len);
+ arg[7 + len] = '\0';
+ if ((r = (char *) tcc_set_linker(s, arg, TRUE)))
+ tcc_error("unsupported linker option '%s'", r);
+ break;
+ }
case TCC_OPTION_Wl:
if ((r = (char *) tcc_set_linker(s, (char *)optarg, TRUE)))
tcc_error("unsupported linker option '%s'", r);
--- a/tcc-doc.texi 2012-01-04 14:40:03.000000000 +0100
+++ b/tcc-doc.texi 2012-03-13 12:53:34.000000000 +0100
@@ -316,6 +316,7 @@
@end table
@item -Wl,-rpath=path
+@item -rpath path
Set custom library search path
@end table