History

libtcc: support multiple -Wl,-rpath=...'s

grischka committed 9 years ago

Commit ee5425f1 parent 362cafb1 file · +11 −7Browse files

Unified · Split

libtcc.c+11−7
@@ -1310,11 +1310,15 @@ static const char *skip_linker_arg(const char **str) · 1309 unmodified lines
1310 return s2;1310 return s2;
1311}1311}
1312 1312
1313static char *copy_linker_arg(const char *p)1313static void copy_linker_arg(char **pp, const char *s, int sep)
1314{1314{
1315 const char *q = p;1315 const char *q = s;
1316 char *p = *pp;
1317 int l = 0;
1318 if (p && sep)
1319 p[l = strlen(p)] = sep, ++l;
1316 skip_linker_arg(&q);1320 skip_linker_arg(&q);
1317 return pstrncpy(tcc_malloc(q - p + 1), p, q - p);1321 pstrncpy(l + (*pp = tcc_realloc(p, q - s + l + 1)), s, q - s);
1318}1322}
1319 1323
1320/* set linker options */1324/* set linker options */
@@ -1332,14 +1336,14 @@ static int tcc_set_linker(TCCState *s, const char *option) · 11 unmodified lines
1332 } else if (link_option(option, "nostdlib", &p)) {1336 } else if (link_option(option, "nostdlib", &p)) {
1333 s->nostdlib = 1;1337 s->nostdlib = 1;
1334 } else if (link_option(option, "fini=", &p)) {1338 } else if (link_option(option, "fini=", &p)) {
1335 s->fini_symbol = copy_linker_arg(p);1339 copy_linker_arg(&s->fini_symbol, p, 0);
1336 ignoring = 1;1340 ignoring = 1;
1337 } else if (link_option(option, "image-base=", &p)1341 } else if (link_option(option, "image-base=", &p)
1338 || link_option(option, "Ttext=", &p)) {1342 || link_option(option, "Ttext=", &p)) {
1339 s->text_addr = strtoull(p, &end, 16);1343 s->text_addr = strtoull(p, &end, 16);
1340 s->has_text_addr = 1;1344 s->has_text_addr = 1;
1341 } else if (link_option(option, "init=", &p)) {1345 } else if (link_option(option, "init=", &p)) {
1342 s->init_symbol = copy_linker_arg(p);1346 copy_linker_arg(&s->init_symbol, p, 0);
1343 ignoring = 1;1347 ignoring = 1;
1344 } else if (link_option(option, "oformat=", &p)) {1348 } else if (link_option(option, "oformat=", &p)) {
1345#if defined(TCC_TARGET_PE)1349#if defined(TCC_TARGET_PE)
@@ -1364,11 +1368,11 @@ static int tcc_set_linker(TCCState *s, const char *option) · 18 unmodified lines
1364 } else if (link_option(option, "O", &p)) {1368 } else if (link_option(option, "O", &p)) {
1365 ignoring = 1;1369 ignoring = 1;
1366 } else if (link_option(option, "rpath=", &p)) {1370 } else if (link_option(option, "rpath=", &p)) {
1367 s->rpath = copy_linker_arg(p);1371 copy_linker_arg(&s->rpath, p, ':');
1368 } else if (link_option(option, "section-alignment=", &p)) {1372 } else if (link_option(option, "section-alignment=", &p)) {
1369 s->section_align = strtoul(p, &end, 16);1373 s->section_align = strtoul(p, &end, 16);
1370 } else if (link_option(option, "soname=", &p)) {1374 } else if (link_option(option, "soname=", &p)) {
1371 s->soname = copy_linker_arg(p);1375 copy_linker_arg(&s->soname, p, 0);
1372#ifdef TCC_TARGET_PE1376#ifdef TCC_TARGET_PE
1373 } else if (link_option(option, "large-address-aware", &p)) {1377 } else if (link_option(option, "large-address-aware", &p)) {
1374 s->pe_characteristics |= 0x20;1378 s->pe_characteristics |= 0x20;

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