History

Fix netbsd elf problem

The dynamic linker on netbsd can only handle 2 PT_LOAD sections.

herman ten brugge committed 4 years ago

Commit 4589fdf1 parent 09808f31 file · +6 −0Browse files

Unified · Split

tccelf.c+6−0
@@ -1951,8 +1951,14 @@ static int sort_sections(TCCState *s1, int *sec_order, Section *interp) · 1950 unmodified lines
1951 f = 0;1951 f = 0;
1952 if (k < 0x700) {1952 if (k < 0x700) {
1953 f = s->sh_flags & (SHF_ALLOC|SHF_WRITE|SHF_EXECINSTR|SHF_TLS);1953 f = s->sh_flags & (SHF_ALLOC|SHF_WRITE|SHF_EXECINSTR|SHF_TLS);
1954#if TARGETOS_NetBSD
1955 /* NetBSD only supports 2 PT_LOAD sections.
1956 See: https://blog.netbsd.org/tnf/entry/the_first_report_on_lld */
1957 if ((f & SHF_WRITE) == 0) f |= SHF_EXECINSTR;
1958#else
1954 if ((k & 0xfff0) == 0x240) /* RELRO sections */1959 if ((k & 0xfff0) == 0x240) /* RELRO sections */
1955 f |= 1<<4;1960 f |= 1<<4;
1961#endif
1956 if (f != f0) /* start new header when flags changed or relro */1962 if (f != f0) /* start new header when flags changed or relro */
1957 f0 = f, ++n, f |= 1<<8;1963 f0 = f, ++n, f |= 1<<8;
1958 }1964 }

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