Avoid Invalid relocation and section conflict on bsd.

With recent changes I got:
/usr/lib/crtbegin.o: error: Invalid relocation entry [ 2] '.rela.text' @ 0000007a
And:
libtcc.o: error: section type conflict: .eh_frame 01 <> 70000001
This commit is contained in:
herman ten brugge 2024-12-12 20:46:00 +01:00
parent d440ed819c
commit 68c8c352fd

View file

@ -3169,9 +3169,11 @@ invalid:
|| 0 == strncmp(sh_name, ".stab", 5)) {
if (!s1->do_debug || seencompressed)
continue;
#if !(TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD)
} else if (0 == strncmp(sh_name, ".eh_frame", 9)) {
if (NULL == eh_frame_section)
continue;
#endif
} else
if (sh->sh_type != SHT_PROGBITS &&
sh->sh_type != SHT_NOTE &&
@ -3181,6 +3183,9 @@ invalid:
sh->sh_type != SHT_FINI_ARRAY
#ifdef TCC_ARM_EABI
&& sh->sh_type != SHT_ARM_EXIDX
#endif
#if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD
&& sh->sh_type != SHT_X86_64_UNWIND
#endif
)
continue;
@ -3195,7 +3200,7 @@ invalid:
if (strcmp(s->name, sh_name))
continue;
if (sh->sh_type != s->sh_type
&& s != eh_frame_section
&& strcmp (s->name, ".eh_frame")
) {
tcc_error_noabort("section type conflict: %s %02x <> %02x", s->name, sh->sh_type, s->sh_type);
goto the_end;