Hi!

Pretty stormy here, huh?

i wrote:
 |Hello again!
 |
 |I have just recognized that i need to use -Wl,-rpath now (new

 |So then, here we go:
 |  ?0[steffen@wales nail.git]$ readelf -d s-nail

 |   0x000000000000000f (RPATH)              Library rpath: [/usr/lib]

 |This is still true for [mob:1ca685f], but which no longer needs
 |a cherry-picked commit to do it.  Cool!  :-)

With the attached diff we get

  ?0[steffen@wales nail.git]$ readelf -d s-nail
  Dynamic section at offset 0xf6a78 contains 19 entries:
    Tag        Type                         Name/Value
   0x0000000000000001 (NEEDED)             Shared library: [libssl.so.1.1]
   0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.1.1]

   0x000000000000000f (RPATH)              Library rpath: 
[/home/steffen/usr/opt/.ssl-1.1.0/lib:/home/steffen/usr/lib:/home/steffen/usr/opt/tcc-mob/lib:/home/steffen/usr/opt/pcc/lib:/lib:/usr/local/lib:/usr/lib]

Yay.
Ciao!

--steffen
diff --git a/libtcc.c b/libtcc.c
index 12ee171..6759daa 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1880,7 +1880,19 @@ 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);
+            char *pbuf = copy_linker_arg(p);
+
+            if (s->rpath != NULL) {
+                size_t plen = strlen(pbuf) +1, ol = strlen(s->rpath);
+                char *nbuf = tcc_malloc(ol + 1 + plen);
+
+                memcpy(nbuf, s->rpath, ol);
+                nbuf[ol++] = ':';
+                tcc_free(s->rpath);
+                memcpy(&nbuf[ol], pbuf, plen);
+                s->rpath = nbuf;
+            } else
+                s->rpath = pbuf;
         } 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
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to