Skip to content

Commit 8babbf1

Browse files
committed
regression testing stabilization
caused by commit id 128e789 spotted when compiling linux-tcc kernel executable section must appear first for a bootable linux-tcc kernel it is not yet fully confirmed if re-ordering sections for this clashes with requirements related to TLS support so far extensive regression-testing including this minor revert passed with i386-tcc again
1 parent 581d2e1 commit 8babbf1

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎tccelf.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,7 @@ static int sort_sections(TCCState *s1, int *sec_order, struct dyn_inf *d)
23022302
if (s1->plt && s == s1->plt->reloc)
23032303
k = 0x21;
23042304
} else if (s->sh_flags & SHF_EXECINSTR) {
2305-
k = 0x60;
2305+
k = 0x30;
23062306
/* RELRO sections --> */
23072307
} else if (s->sh_flags & SHF_TLS) {
23082308
if (s->sh_addralign > tls_align)
@@ -2322,7 +2322,7 @@ static int sort_sections(TCCState *s1, int *sec_order, struct dyn_inf *d)
23222322
k = 0x45; /* +1 for data.ro */
23232323
/* <-- */
23242324
} else if (s->sh_type == SHT_NOTE) {
2325-
k = 0x08, d->notes = 1;
2325+
k = 0x60; d->notes = 1;
23262326
} else if (s->sh_type == SHT_NOBITS) {
23272327
k = 0x70; /* bss */
23282328
} else if (s == d->interp) {
@@ -2331,9 +2331,14 @@ static int sort_sections(TCCState *s1, int *sec_order, struct dyn_inf *d)
23312331
k = 0x50; /* data */
23322332
}
23332333
k += j;
2334-
/* make our standard sections come last to have _etext/_edata correct values */
2335-
if (s->sh_num <= bss_section->sh_num)
2336-
++k;
2334+
2335+
// THIS further breaks linking order of executable section for kernel
2336+
// it is NOT clarified how this interacts with TLS related changes
2337+
//
2338+
///* make our standard sections come last to have _etext/_edata correct values */
2339+
//if (s->sh_num <= bss_section->sh_num)
2340+
// ++k;
2341+
23372342
/* make RELRO section writable */
23382343
if ((k & 0xfff0) == 0x140)
23392344
k += 0x100, s->sh_flags |= SHF_WRITE;

0 commit comments

Comments
 (0)