summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherman ten brugge <hermantenbrugge@home.nl>2023-11-08 21:03:10 +0100
committerherman ten brugge <hermantenbrugge@home.nl>2023-11-08 21:03:10 +0100
commitfc8c01861b0be844cba114848acf2ae7ef8a658a (patch)
treeba1c7359eb28a119bfa7fe2d96d0cc4741bffcde
parentded713e90dde1eba60a9c9156e4c00a734039142 (diff)
Fix STT_NOTYPE problem on win32
Since 'make undefined global symbol STT_NOTYPE' change win32 code did not build any more.
-rw-r--r--tccelf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tccelf.c b/tccelf.c
index abcfb10..3ddbe48 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -176,11 +176,13 @@ ST_FUNC void tccelf_end_file(TCCState *s1)
if (sym->st_shndx == SHN_UNDEF
&& ELFW(ST_BIND)(sym->st_info) == STB_LOCAL)
sym->st_info = ELFW(ST_INFO)(STB_GLOBAL, ELFW(ST_TYPE)(sym->st_info));
+#ifndef TCC_TARGET_PE
/* An ELF relocatable file should have the types of its undefined global symbol set
to STT_NOTYPE or it will confuse binutils bfd */
if (s1->output_format == TCC_OUTPUT_FORMAT_ELF && s1->output_type == TCC_OUTPUT_OBJ)
if (sym->st_shndx == SHN_UNDEF && ELFW(ST_BIND)(sym->st_info) == STB_GLOBAL)
sym->st_info = ELFW(ST_INFO)(STB_GLOBAL, ELFW(ST_TYPE)(STT_NOTYPE));
+#endif
tr[i] = set_elf_sym(s, sym->st_value, sym->st_size, sym->st_info,
sym->st_other, sym->st_shndx, (char*)s->link->data + sym->st_name);
}