Bäh!
Take this one, please, the other one deleted an option.
Ciao!

--steffen
commit 2b59c82 (HEAD -> refs/heads/i)
Author:     Steffen (Daode) Nurpmeso <stef...@sdaoden.eu>
AuthorDate: 2016-06-04 15:48:15 +0200
Commit:     Steffen (Daode) Nurpmeso <stef...@sdaoden.eu>
CommitDate: 2016-06-06 13:59:30 +0200

    Allow multiple -rpath linker arguments
---
 libtcc.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/libtcc.c b/libtcc.c
index 12ee171..07a3fad 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1834,6 +1834,28 @@ static char *copy_linker_arg(const char *p)
     return pstrncpy(tcc_malloc(q - p + 1), p, q - p);
 }
 
+static char *concat_linker_arg_path(char *opath, const char *p)
+{
+    size_t plen, ol;
+    char *npath, *pbuf;
+
+    pbuf = copy_linker_arg(p);
+
+    if (opath != NULL) {
+        ol = strlen(opath);
+        plen = strlen(pbuf) +1;
+        npath = tcc_malloc(ol + 1 + plen);
+
+        memcpy(npath, opath, ol);
+        tcc_free(opath);
+
+        npath[ol++] = ':';
+        memcpy(&npath[ol], pbuf, plen);
+    } else
+        npath = pbuf;
+    return npath;
+}
+
 /* set linker options */
 static int tcc_set_linker(TCCState *s, const char *option)
 {
@@ -1880,7 +1902,7 @@ static int tcc_set_linker(TCCState *s, const char *option)
         } else if (link_option(option, "O", &p)) {
             ignoring = 1;
         } else if (link_option(option, "rpath=", &p)) {
-            s->rpath = copy_linker_arg(p);
+            s->rpath = concat_linker_arg_path(s->rpath, p);
         } else if (link_option(option, "section-alignment=", &p)) {
             s->section_align = strtoul(p, &end, 16);
         } else if (link_option(option, "soname=", &p)) {
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to