History

tcc: add "-Wl,-rpath=path" option (library search path)

grischka committed 16 years ago

Commit e81569b1 parent dd3d4f75 files · +16 −3Browse files

Unified · Split

5 files
  1. Makefile +2 −2
  2. tcc-doc.texi +6 −0
  3. tcc.c +2 −0
  4. tcc.h +2 −0
  5. tccelf.c +4 −1
Makefile+2−2
@@ -215,12 +215,12 @@ ifneq ($(BCHECK_O),) · 214 unmodified lines
215215 $(INSTALL) -m644 $(BCHECK_O) "$(tccdir)"
216216 endif
217217 $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
218− mkdir -p "$(docdir)"
219− $(INSTALL) -m644 tcc-doc.html "$(docdir)"
220218 mkdir -p "$(libdir)"
221219 $(INSTALL) -m644 libtcc.a "$(libdir)"
222220 mkdir -p "$(includedir)"
223221 $(INSTALL) -m644 libtcc.h "$(includedir)"
222+ mkdir -p "$(docdir)"
223+ -$(INSTALL) -m644 tcc-doc.html "$(docdir)"
224224
225225 uninstall:
226226 rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")
tcc-doc.texi+6−0
@@ -284,6 +284,9 @@ libxxx.a. The library is searched in the paths specified by the · 283 unmodified lines
284284 Generate a shared library instead of an executable (@option{-o} option
285285 must also be given).
286286
287+@item -soname name
288+set name for shared library to be used at runtime
289+
287290 @item -static
288291 Generate a statically linked executable (default is a shared linked
289292 executable) (@option{-o} option must also be given).
@@ -310,6 +313,9 @@ Binary image (only for executable output) · 20 unmodified lines
310313 COFF output format (only for executable output for TMS320C67xx target)
311314 @end table
312315
316+@item -Wl,-rpath=path
317+Set custom library search path
318+
313319 @end table
314320
315321 Debugger options:
tcc.c+2−0
@@ -442,6 +442,8 @@ int parse_args(TCCState *s, int argc, char **argv) · 441 unmodified lines
442442 {
443443 error("target %s not found", p);
444444 }
445+ } else if (strstart(optarg, "-rpath=", &p)) {
446+ s->rpath = p;
445447 } else {
446448 error("unsupported linker option '%s'", optarg);
447449 }
tcc.h+2−0
@@ -434,6 +434,8 @@ struct TCCState { · 433 unmodified lines
434434
435435 /* soname as specified on the command line (-soname) */
436436 const char *soname;
437+ /* rpath as specified on the command line (-Wl,-rpath=) */
438+ const char *rpath;
437439
438440 /* if true, all symbols are exported */
439441 int rdynamic;
tccelf.c+4−1
@@ -1563,6 +1563,10 @@ int elf_output_file(TCCState *s1, const char *filename) · 1562 unmodified lines
15631563 if (dllref->level == 0)
15641564 put_dt(dynamic, DT_NEEDED, put_elf_str(dynstr, dllref->name));
15651565 }
1566+
1567+ if (s1->rpath)
1568+ put_dt(dynamic, DT_RPATH, put_elf_str(dynstr, s1->rpath));
1569+
15661570 /* XXX: currently, since we do not handle PIC code, we
15671571 must relocate the readonly segments */
15681572 if (file_type == TCC_OUTPUT_DLL) {
@@ -1570,7 +1574,6 @@ int elf_output_file(TCCState *s1, const char *filename) · 1 unmodified line
15701574 put_dt(dynamic, DT_SONAME, put_elf_str(dynstr, s1->soname));
15711575 put_dt(dynamic, DT_TEXTREL, 0);
15721576 }
1573−
15741577 /* add necessary space for other entries */
15751578 saved_dynamic_data_offset = dynamic->data_offset;
15761579 dynamic->data_offset += sizeof(ElfW(Dyn)) * EXTRA_RELITEMS;

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