History

Revert "--whole-archive support"

- would parse linker args in two different places - would mess up "tcc -v ..." output: tcc -v test.c -> test.c +> test.c - would use function "tcc_load_alacarte()" to do the contrary of what its name suggests. This reverts commit 19a169ceb896f78205bc23b847938c58f14d1dda.

grischka committed 10 years ago

Commit cf32bb81 parent e238e656 files · +3 −43Browse files

Unified · Split

6 files
  1. libtcc.c +1 −13
  2. libtcc.h +0 −2
  3. tcc-doc.texi +0 −8
  4. tcc.c +2 −16
  5. tcc.h +0 −1
  6. tccelf.c +0 −3
libtcc.c+1−13
@@ -1419,11 +1419,9 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags, · 1418 unmodified lines
14191419 ret = tcc_load_ldscript(s1);
14201420 #endif
14211421 if (ret < 0)
1422− tcc_error_noabort("%s: unrecognized file type (error=%d)", filename, ret);
1422+ tcc_error_noabort("unrecognized file type");
14231423
14241424 the_end:
1425− if (s1->verbose)
1426− printf("+> %s\n", filename);
14271425 tcc_close();
14281426 return ret;
14291427 }
@@ -2321,16 +2319,6 @@ ST_FUNC int tcc_parse_args1(TCCState *s, int argc, char **argv) · 891 unmodified lines
23212319 s->rdynamic = 1;
23222320 break;
23232321 case TCC_OPTION_Wl:
2324− if (optarg && *optarg == '-') {
2325− int offs = 0;
2326− if (!strncmp("-no", optarg+1, 3))
2327− offs += 3;
2328− if (!strcmp("-whole-archive", optarg+1 + offs)) {
2329− args_parser_add_file(s, "", (offs == 0) ? TCC_FILETYPE_AR_WHOLE_ON :
2330− TCC_FILETYPE_AR_WHOLE_OFF);
2331− break;
2332− }
2333− }
23342322 if (pas->linker_arg.size)
23352323 --pas->linker_arg.size, cstr_ccat(&pas->linker_arg, ',');
23362324 cstr_cat(&pas->linker_arg, optarg, 0);
libtcc.h+0−2
@@ -53,8 +53,6 @@ LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename, int filetype); · 52 unmodified lines
5353 #define TCC_FILETYPE_C 2
5454 #define TCC_FILETYPE_ASM 3
5555 #define TCC_FILETYPE_ASM_PP 4
56−#define TCC_FILETYPE_AR_WHOLE_OFF 5
57−#define TCC_FILETYPE_AR_WHOLE_ON 6
5856
5957 /* compile a string containing a C source. Return -1 if error. */
6058 LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf);
tcc-doc.texi+0−8
@@ -317,14 +317,6 @@ Generate an object file combining all input files. · 316 unmodified lines
317317 @item -Wl,-rpath=path
318318 Put custom search path for dynamic libraries into executable.
319319
320−@item -Wl,--whole-archive
321−Add a whole archive, not just the symbols of the archive that would
322−satisfy undefined symbols in the program.
323−
324−@item -Wl,--no-whole-archive
325−Turn off the effect of the --whole-archive option for subsequent archive
326−files.
327−
328320 @item -Wl,--oformat=fmt
329321 Use @var{fmt} as output format. The supported output formats are:
330322 @table @code
tcc.c+2−16
@@ -247,13 +247,6 @@ static int64_t getclock_us(void) · 246 unmodified lines
247247 #endif
248248 }
249249
250−static void set_whole_archive(TCCState* s, int on)
251−{
252− s->whole_archive = on;
253− if (1 == s->verbose)
254− printf("%cwhole-archive>\n", s->whole_archive? '+' : '-');
255−}
256−
257250 int main(int argc, char **argv)
258251 {
259252 TCCState *s;
@@ -308,14 +301,6 @@ int main(int argc, char **argv) · 48 unmodified lines
308301 for(i = ret = 0; i < s->nb_files && ret == 0; i++) {
309302 int filetype = *(unsigned char *)s->files[i];
310303 const char *filename = s->files[i] + 1;
311− if (filetype == TCC_FILETYPE_AR_WHOLE_ON ||
312− filetype == TCC_FILETYPE_AR_WHOLE_OFF)
313− {
314− set_whole_archive(s, filetype == TCC_FILETYPE_AR_WHOLE_ON);
315− continue;
316− }
317− if (1 == s->verbose)
318− printf("-> %s\n", filename);
319304 if (filename[0] == '-' && filename[1] == 'l') {
320305 if (tcc_add_library(s, filename + 2) < 0) {
321306 /* don't fail on -lm as it's harmless to skip math lib */
@@ -325,6 +310,8 @@ int main(int argc, char **argv) · 3 unmodified lines
325310 }
326311 }
327312 } else {
313+ if (1 == s->verbose)
314+ printf("-> %s\n", filename);
328315 if (!s->outfile)
329316 s->outfile = default_outputfile(s, filename);
330317 if (tcc_add_file(s, filename, filetype) < 0)
@@ -348,7 +335,6 @@ int main(int argc, char **argv) · 17 unmodified lines
348335 }
349336 }
350337 }
351− set_whole_archive(s, 0);
352338
353339 if (0 == ret) {
354340 if (s->output_type == TCC_OUTPUT_MEMORY) {
tcc.h+0−1
@@ -692,7 +692,6 @@ struct TCCState { · 691 unmodified lines
692692 int rdynamic; /* if true, all symbols are exported */
693693 int symbolic; /* if true, resolve symbols in the current module first */
694694 int alacarte_link; /* if true, only link in referenced objects from archive */
695− int whole_archive; /* if true, link in a whole *.a even when alacarte_link */
696695
697696 char *tcc_lib_path; /* CONFIG_TCCDIR or -B option */
698697 char *soname; /* as specified on the command line (-soname) */
tccelf.c+0−3
@@ -3076,7 +3076,6 @@ static int tcc_load_alacarte(TCCState *s1, int fd, int size) · 3075 unmodified lines
30763076 if(sym_index) {
30773077 sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
30783078 if(sym->st_shndx == SHN_UNDEF) {
3079− load_obj:
30803079 off = get_be32(ar_index + i * 4) + sizeof(ArchiveHeader);
30813080 ++bound;
30823081 lseek(fd, off, SEEK_SET);
@@ -3086,8 +3085,6 @@ static int tcc_load_alacarte(TCCState *s1, int fd, int size) · 3 unmodified lines
30863085 goto the_end;
30873086 }
30883087 }
3089− } else if (s1->whole_archive) {
3090− goto load_obj;
30913088 }
30923089 }
30933090 } while(bound);

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