History

-Wl, --enable-new-dtags for DT_RUNPATH instead of DT_RPATH

Today by accident i had to deal with linker problems of some software and found an issue that mentioned DT_RUNPATH, which mentioned that DT_RPATH is legacy and searched for $LD_LIBRARY_PATH, whereas the newer DT_RUNPATH is searched thereafter. Completely unencrypted! Well. For what's it worth, i for one am astonished because of course i want to override $LD_LIBRARY_PATH, but it surely has its merites, smart people came to the conclusion, did they. The attached diff below seems to be sufficient to support DT_RUNPATH instead of DT_RPATH with tcc(1). But i have no insight in what --enable-new-dtags is supposed to change in addition, so i wonder. Ciao! --steffen libtcc.c | 2 ++ tcc-doc.texi | 4 ++++ tcc.h | 1 + tccelf.c | 3 ++- 4 files changed, 9 insertions(+), 1 deletion(-)

Steffen Nurpmeso committed 9 years ago

Commit f34b1fe1 parent 096125d4 files · +9 −1Browse files

Unified · Split

4 files
  1. libtcc.c +2 −0
  2. tcc-doc.texi +4 −0
  3. tcc.h +1 −0
  4. tccelf.c +2 −1
libtcc.c+2−0
@@ -1377,6 +1377,8 @@ static int tcc_set_linker(TCCState *s, const char *option) · 1376 unmodified lines
13771377 ignoring = 1;
13781378 } else if (link_option(option, "rpath=", &p)) {
13791379 copy_linker_arg(&s->rpath, p, ':');
1380+ } else if (link_option(option, "enable-new-dtags", &p)) {
1381+ s->enable_new_dtags = 1;
13801382 } else if (link_option(option, "section-alignment=", &p)) {
13811383 s->section_align = strtoul(p, &end, 16);
13821384 } else if (link_option(option, "soname=", &p)) {
tcc-doc.texi+4−0
@@ -307,6 +307,10 @@ Generate an object file combining all input files. · 306 unmodified lines
307307 @item -Wl,-rpath=path
308308 Put custom search path for dynamic libraries into executable.
309309
310+@item -Wl,--enable-new-dtags
311+When putting a custom search path for dynamic libraries into the executable,
312+create the new ELF dynamic tag DT_RUNPATH instead of the old legacy DT_RPATH.
313+
310314 @item -Wl,--oformat=fmt
311315 Use @var{fmt} as output format. The supported output formats are:
312316 @table @code
tcc.h+1−0
@@ -605,6 +605,7 @@ struct TCCState { · 604 unmodified lines
605605 char *tcc_lib_path; /* CONFIG_TCCDIR or -B option */
606606 char *soname; /* as specified on the command line (-soname) */
607607 char *rpath; /* as specified on the command line (-Wl,-rpath=) */
608+ int enable_new_dtags; /* ditto, (-Wl,--enable-new-dtags) */
608609
609610 /* output type, see TCC_OUTPUT_XXX */
610611 int output_type;
tccelf.c+2−1
@@ -1968,7 +1968,8 @@ static int elf_output_file(TCCState *s1, const char *filename) · 1967 unmodified lines
19681968 }
19691969
19701970 if (s1->rpath)
1971− put_dt(dynamic, DT_RPATH, put_elf_str(dynstr, s1->rpath));
1971+ put_dt(dynamic, s1->enable_new_dtags ? DT_RUNPATH : DT_RPATH,
1972+ put_elf_str(dynstr, s1->rpath));
19721973
19731974 /* XXX: currently, since we do not handle PIC code, we
19741975 must relocate the readonly segments */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t