summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Sosedkin <monk@unboiled.info>2021-10-30 16:04:11 +0200
committerAlexander Sosedkin <monk@unboiled.info>2021-10-30 16:07:00 +0200
commitda11cf651576f94486dbd043dbfcde469e497574 (patch)
treef6255cb026929254b4e51d4bd47381d593641edc
parent16456168430c9e185dd94b8215aa77d02bbb8a2c (diff)
Don't skip weak symbols during ar creation
``` $ echo 'int __attribute__((__weak__)) f(void) { return 4; }' > w.c $ tcc -c w.c -o w.o $ tcc-old -ar rc w.a w.o; nm -s w.a # previous behaviour, not indexed w.o: 0000000000000000 W f $ ar rc w.a w.o; nm -s w.a # GNU binutils behaviour, indexed Archive index: f in w.o 0000000000000000 W f $ tcc-new rc w.a w.o; nm -s w.a # new behaviour, indexed Archive index: f in w.o 0000000000000000 W f ```
-rw-r--r--tcctools.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tcctools.c b/tcctools.c
index cf17496..4567b81 100644
--- a/tcctools.c
+++ b/tcctools.c
@@ -200,6 +200,9 @@ ST_FUNC int tcc_tool_ar(TCCState *s1, int argc, char **argv)
(sym->st_info == 0x10
|| sym->st_info == 0x11
|| sym->st_info == 0x12
+ || sym->st_info == 0x20
+ || sym->st_info == 0x21
+ || sym->st_info == 0x22
)) {
//printf("symtab: %2Xh %4Xh %2Xh %s\n", sym->st_info, sym->st_size, sym->st_shndx, strtab + sym->st_name);
istrlen = strlen(strtab + sym->st_name)+1;