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
215 $(INSTALL) -m644 $(BCHECK_O) "$(tccdir)"215 $(INSTALL) -m644 $(BCHECK_O) "$(tccdir)"
216endif216endif
217 $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"217 $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
218 mkdir -p "$(docdir)"
219 $(INSTALL) -m644 tcc-doc.html "$(docdir)"
220 mkdir -p "$(libdir)"218 mkdir -p "$(libdir)"
221 $(INSTALL) -m644 libtcc.a "$(libdir)"219 $(INSTALL) -m644 libtcc.a "$(libdir)"
222 mkdir -p "$(includedir)"220 mkdir -p "$(includedir)"
223 $(INSTALL) -m644 libtcc.h "$(includedir)"221 $(INSTALL) -m644 libtcc.h "$(includedir)"
222 mkdir -p "$(docdir)"
223 -$(INSTALL) -m644 tcc-doc.html "$(docdir)"
224 224
225uninstall:225uninstall:
226 rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")226 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
284Generate a shared library instead of an executable (@option{-o} option284Generate a shared library instead of an executable (@option{-o} option
285must also be given).285must also be given).
286 286
287@item -soname name
288set name for shared library to be used at runtime
289
287@item -static290@item -static
288Generate a statically linked executable (default is a shared linked291Generate a statically linked executable (default is a shared linked
289executable) (@option{-o} option must also be given).292executable) (@option{-o} option must also be given).
@@ -310,6 +313,9 @@ Binary image (only for executable output) · 20 unmodified lines
310COFF output format (only for executable output for TMS320C67xx target)313COFF output format (only for executable output for TMS320C67xx target)
311@end table314@end table
312 315
316@item -Wl,-rpath=path
317Set custom library search path
318
313@end table319@end table
314 320
315Debugger options:321Debugger options:
tcc.c+2−0
@@ -442,6 +442,8 @@ int parse_args(TCCState *s, int argc, char **argv) · 441 unmodified lines
442 {442 {
443 error("target %s not found", p);443 error("target %s not found", p);
444 }444 }
445 } else if (strstart(optarg, "-rpath=", &p)) {
446 s->rpath = p;
445 } else {447 } else {
446 error("unsupported linker option '%s'", optarg);448 error("unsupported linker option '%s'", optarg);
447 }449 }
tcc.h+2−0
@@ -434,6 +434,8 @@ struct TCCState { · 433 unmodified lines
434 434
435 /* soname as specified on the command line (-soname) */435 /* soname as specified on the command line (-soname) */
436 const char *soname;436 const char *soname;
437 /* rpath as specified on the command line (-Wl,-rpath=) */
438 const char *rpath;
437 439
438 /* if true, all symbols are exported */440 /* if true, all symbols are exported */
439 int rdynamic;441 int rdynamic;
tccelf.c+4−1
@@ -1563,6 +1563,10 @@ int elf_output_file(TCCState *s1, const char *filename) · 1562 unmodified lines
1563 if (dllref->level == 0)1563 if (dllref->level == 0)
1564 put_dt(dynamic, DT_NEEDED, put_elf_str(dynstr, dllref->name));1564 put_dt(dynamic, DT_NEEDED, put_elf_str(dynstr, dllref->name));
1565 }1565 }
1566
1567 if (s1->rpath)
1568 put_dt(dynamic, DT_RPATH, put_elf_str(dynstr, s1->rpath));
1569
1566 /* XXX: currently, since we do not handle PIC code, we1570 /* XXX: currently, since we do not handle PIC code, we
1567 must relocate the readonly segments */1571 must relocate the readonly segments */
1568 if (file_type == TCC_OUTPUT_DLL) {1572 if (file_type == TCC_OUTPUT_DLL) {
@@ -1570,7 +1574,6 @@ int elf_output_file(TCCState *s1, const char *filename) · 1 unmodified line
1570 put_dt(dynamic, DT_SONAME, put_elf_str(dynstr, s1->soname));1574 put_dt(dynamic, DT_SONAME, put_elf_str(dynstr, s1->soname));
1571 put_dt(dynamic, DT_TEXTREL, 0);1575 put_dt(dynamic, DT_TEXTREL, 0);
1572 }1576 }
1573
1574 /* add necessary space for other entries */1577 /* add necessary space for other entries */
1575 saved_dynamic_data_offset = dynamic->data_offset;1578 saved_dynamic_data_offset = dynamic->data_offset;
1576 dynamic->data_offset += sizeof(ElfW(Dyn)) * EXTRA_RELITEMS;1579 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