Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions tccrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,14 @@ static int tcc_relocate_ex(TCCState *s1, void *ptr, unsigned ptr_diff)
if (NULL == ptr) {
s1->nb_errors = 0;
/* An in-memory image gets no PT_TLS segment, so thread-pointer
relative accesses would silently alias the host's TLS block. */
if (tdata_section->data_offset || tbss_section->data_offset)
return tcc_error_noabort("thread-local storage is not supported at run time");
relative accesses would silently alias the host's TLS block.
Scan SHF_TLS (not just the two canonical section pointers) so
per-symbol .tdata.foo/.tbss.foo from linked objects are caught. */
for (i = 1; i < s1->nb_sections; i++) {
s = s1->sections[i];
if ((s->sh_flags & SHF_TLS) && s->data_offset)
return tcc_error_noabort("thread-local storage is not supported at run time");
}
#ifdef TCC_TARGET_PE
pe_output_file(s1, NULL);
#else
Expand Down
6 changes: 6 additions & 0 deletions tests/tests2/73_arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,10 @@ static uint64_t sublp4095(uint64_t x) { return x - 4095; }
static uint32_t subim503808(uint32_t x) { return x - -503808; }
static uint64_t addp12345(uint64_t x) { return x + 12345; }
static uint32_t subp12345(uint32_t x) { return x - 12345; }
/* LLP64 guard: these drop the high bits (print 3e8) when arm64_gen_opic's
fits-in-immediate mask truncates to 32 bits on an LLP64-built tcc. */
static uint64_t addlpbit49(uint64_t x) { return x + (1ll << 49); }
static uint64_t addlp4g(uint64_t x) { return x + 0x100000000ll; }

static uint32_t mvni(uint32_t x) { return 0xffffffff - x; }
static uint64_t negl(uint64_t x) { return 0 - x; }
Expand Down Expand Up @@ -507,6 +511,8 @@ void opi(void)
pll(subim503808(x));
pll(addp12345(x));
pll(subp12345(x));
pll(addlpbit49(x));
pll(addlp4g(x));
pll(mvni(x));
pll(negl(x));
pll(rsbi123(x));
Expand Down
2 changes: 2 additions & 0 deletions tests/tests2/73_arm64.expect
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ fffffffffffff3e9
7b3e8
3421
ffffd3af
20000000003e8
1000003e8
fffffc17
fffffffffffffc18
fffffc93
Expand Down