mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-06 06:40:07 +08:00
Fix netbsd elf problem
The dynamic linker on netbsd can only handle 2 PT_LOAD sections.
This commit is contained in:
parent
09808f327f
commit
4589fdfad4
6
tccelf.c
6
tccelf.c
@ -1951,8 +1951,14 @@ static int sort_sections(TCCState *s1, int *sec_order, Section *interp)
|
||||
f = 0;
|
||||
if (k < 0x700) {
|
||||
f = s->sh_flags & (SHF_ALLOC|SHF_WRITE|SHF_EXECINSTR|SHF_TLS);
|
||||
#if TARGETOS_NetBSD
|
||||
/* NetBSD only supports 2 PT_LOAD sections.
|
||||
See: https://blog.netbsd.org/tnf/entry/the_first_report_on_lld */
|
||||
if ((f & SHF_WRITE) == 0) f |= SHF_EXECINSTR;
|
||||
#else
|
||||
if ((k & 0xfff0) == 0x240) /* RELRO sections */
|
||||
f |= 1<<4;
|
||||
#endif
|
||||
if (f != f0) /* start new header when flags changed or relro */
|
||||
f0 = f, ++n, f |= 1<<8;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user