diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2013-11-03 18:55:54 +0800 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2013-11-03 18:55:54 +0800 |
| commit | cf02f920c148a77794b05ba09d73586e5f0b3601 (patch) | |
| tree | d35e02afb9539566893e4e09cee83c9a4886ac2b | |
| parent | 1c4afd13501f07a673aed5f130166f2ee0f30927 (diff) | |
| download | tinycc-cf02f920c148a77794b05ba09d73586e5f0b3601.tar.gz tinycc-cf02f920c148a77794b05ba09d73586e5f0b3601.tar.bz2 | |
Revert "Add support for thread-local storage variables"
TLS support in tinyCC is absolutely not ready:
- segment register not select in load and store
- no relocation added for computing offset of per-thread symbol
- no support for TLS-specific relocations
- no program header added as per Drepper document about TLS
This reverts commit 1c4afd13501f07a673aed5f130166f2ee0f30927.
| -rw-r--r-- | elf.h | 4 | ||||
| -rw-r--r-- | libtcc.c | 5 | ||||
| -rw-r--r-- | tccelf.c | 29 | ||||
| -rw-r--r-- | tccgen.c | 29 | ||||
| -rw-r--r-- | tcctok.h | 1 |
5 files changed, 14 insertions, 54 deletions
@@ -447,7 +447,6 @@ typedef struct #define STT_SECTION 3 /* Symbol associated with a section */ #define STT_FILE 4 /* Symbol's name is file name */ #define STT_NUM 5 /* Number of defined types. */ -#define STT_TLS 6 /* Symbol is a thread-local data object */ #define STT_GNU_IFUNC 10 /* Symbol is a indirect code object */ #define STT_LOOS 11 /* Start of OS-specific */ #define STT_HIOS 12 /* End of OS-specific */ @@ -556,8 +555,7 @@ typedef struct #define PT_NOTE 4 /* Auxiliary information */ #define PT_SHLIB 5 /* Reserved */ #define PT_PHDR 6 /* Entry for header table itself */ -#define PT_TLS 7 /* Thread-local program segment */ -#define PT_NUM 8 /* Number of defined types. */ +#define PT_NUM 7 /* Number of defined types. */ #define PT_LOOS 0x60000000 /* Start of OS-specific */ #define PT_HIOS 0x6fffffff /* End of OS-specific */ #define PT_LOPROC 0x70000000 /* Start of processor-specific */ @@ -444,10 +444,7 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section, } else if ((sym->type.t & VT_BTYPE) == VT_VOID) { sym_type = STT_NOTYPE; } else { - if (section && section->sh_flags & SHF_TLS) - sym_type = STT_TLS; - else - sym_type = STT_OBJECT; + sym_type = STT_OBJECT; } if (sym->type.t & VT_STATIC) @@ -1543,7 +1543,6 @@ static int elf_output_file(TCCState *s1, const char *filename) int fd, mode, ret; int *section_order; int shnum, i, phnum, file_offset, offset, size, j, sh_order_index, k; - int have_tls_section = 0; long long tmp; addr_t addr; Section *strsec, *s; @@ -1862,11 +1861,6 @@ static int elf_output_file(TCCState *s1, const char *filename) /* we output all sections if debug or object file */ s->sh_size = s->data_offset; } - /* if tls section we'll need to add one segment */ - if (s->sh_flags & SHF_TLS) { - have_tls_section = 1; - phnum++; - } } /* allocate program segment headers */ @@ -1910,16 +1904,12 @@ static int elf_output_file(TCCState *s1, const char *filename) if (interp) ph += 1 + HAVE_PHDR; - for(j = 0; j < 2 + have_tls_section; j++) { - if (j != 2) - ph->p_type = PT_LOAD; - else - ph->p_type = PT_TLS; - ph->p_flags = PF_R; + for(j = 0; j < 2; j++) { + ph->p_type = PT_LOAD; if (j == 0) - ph->p_flags |= PF_X; - else if (j == 1) - ph->p_flags |= PF_W; + ph->p_flags = PF_R | PF_X; + else + ph->p_flags = PF_R | PF_W; ph->p_align = s1->section_align; /* we do the following ordering: interp, symbol tables, @@ -1930,15 +1920,12 @@ static int elf_output_file(TCCState *s1, const char *filename) s = s1->sections[i]; /* compute if section should be included */ if (j == 0) { - if ((s->sh_flags & (SHF_ALLOC | SHF_WRITE | SHF_TLS)) != + if ((s->sh_flags & (SHF_ALLOC | SHF_WRITE)) != SHF_ALLOC) continue; - } else if (j == 1) { - if ((s->sh_flags & (SHF_ALLOC | SHF_WRITE | SHF_TLS)) != - (SHF_ALLOC | SHF_WRITE)) - continue; } else { - if ((s->sh_flags & SHF_TLS) != SHF_TLS) + if ((s->sh_flags & (SHF_ALLOC | SHF_WRITE)) != + (SHF_ALLOC | SHF_WRITE)) continue; } if (s == interp) { @@ -31,7 +31,6 @@ ST_DATA int rsym, anon_sym, ind, loc; ST_DATA Section *text_section, *data_section, *bss_section; /* predefined sections */ -ST_DATA Section *tdata_section, *tbss_section; /* thread-local storage sections */ ST_DATA Section *cur_text_section; /* current section where function code is generated */ #ifdef CONFIG_TCC_ASM ST_DATA Section *last_text_section; /* to handle .previous asm directive */ @@ -3093,10 +3092,6 @@ static int parse_btype(CType *type, AttributeDef *ad) t |= VT_INLINE; next(); break; - case TOK_THREAD: - t |= VT_TLS; - next(); - break; /* GNUC attribute */ case TOK_ATTRIBUTE1: @@ -5500,26 +5495,10 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, /* allocate symbol in corresponding section */ sec = ad->section; if (!sec) { - if (has_init) { - if (type->t & VT_TLS) { - if (!tdata_section) - tdata_section = new_section(tcc_state, ".tdata", - SHT_PROGBITS, - SHF_ALLOC | SHF_WRITE | SHF_TLS); - sec = tdata_section; - } else - sec = data_section; - } - else if (tcc_state->nocommon) { - if (type->t & VT_TLS) { - if (!tbss_section) - tbss_section = new_section(tcc_state, ".tbss", - SHT_NOBITS, - SHF_ALLOC | SHF_WRITE | SHF_TLS); - sec = tbss_section; - } else - sec = bss_section; - } + if (has_init) + sec = data_section; + else if (tcc_state->nocommon) + sec = bss_section; } if (sec) { data_offset = sec->data_offset; @@ -10,7 +10,6 @@ DEF(TOK_FOR, "for") DEF(TOK_EXTERN, "extern") DEF(TOK_STATIC, "static") - DEF(TOK_THREAD, "__thread") DEF(TOK_UNSIGNED, "unsigned") DEF(TOK_GOTO, "goto") DEF(TOK_DO, "do") |
