diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2012-08-22 07:02:07 (GMT) |
---|---|---|
committer | Pekka Paalanen <ppaalanen@gmail.com> | 2012-08-22 07:12:37 (GMT) |
commit | 056e8096a2b6598252363295fe52e3a15a4afa33 (patch) | |
tree | 338a77a8e1066a4fda55a0ea7bbfc4e07004a65e | |
parent | 04d160c28429a91821db5ffea6473cfde5912842 (diff) | |
download | androgenizer-pq.tar.gz androgenizer-pq.tar.xz |
ldflags: handle -R and -L with ldflag_actionpq
-rw-r--r-- | library.c | 22 | ||||
-rw-r--r-- | options.c | 8 |
2 files changed, 15 insertions, 15 deletions
@@ -48,6 +48,7 @@ enum library_type library_scope(char *name) enum flag_arg { FLAG_ARG_NO, FLAG_ARG_YES, + FLAG_ARG_JOINED, }; struct flag_exclusion { @@ -62,6 +63,8 @@ static const struct flag_exclusion dropped_ldflags[] = { { "-no-undefined", FLAG_ARG_NO }, { "-dlopen", FLAG_ARG_YES }, { "-version-info", FLAG_ARG_YES }, + { "-L", FLAG_ARG_JOINED }, + { "-R", FLAG_ARG_JOINED }, { NULL, 0 } }; @@ -70,19 +73,24 @@ enum flag_action ldflag_action(const char *flag) const struct flag_exclusion *fe; for (fe = &dropped_ldflags[0]; fe->name; fe++) { - if (strcmp(flag, fe->name) != 0) - continue; + if (fe->arg == FLAG_ARG_JOINED) { + if (strncmp(flag, fe->name, strlen(fe->name)) != 0) + continue; + } else { + if (strcmp(flag, fe->name) != 0) + continue; + } switch (fe->arg) { case FLAG_ARG_NO: return FLAG_SKIP; case FLAG_ARG_YES: return FLAG_SKIP_WITH_ARG; - /* case FLAG_ARG_JOINED: - If an argument is immediately in this flag, - return FLAG_SKIP, otherwise there must be - an argument as the next word, so return - FLAG_SKIP_WITH_ARG. */ + case FLAG_ARG_JOINED: + if (strlen(flag) == strlen(fe->name)) + return FLAG_SKIP_WITH_ARG; + else + return FLAG_SKIP; } } @@ -384,14 +384,6 @@ static int add_ldflag(struct module *m, char *flag, enum build_type btype) } if (flag[0] == '-') { - if (flag[1] == 'L') { - free(flag); - return 0; - } - if (flag[1] == 'R') { - free(flag); - return 0; - } action = ldflag_action(flag); if (action == FLAG_SKIP) { free(flag); |