diff options
| author | grischka <grischka> | 2016-10-19 19:15:04 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2016-10-19 19:21:36 +0200 |
| commit | 02642bc94cb65a59a9eb95b8214bf66960ecde6e (patch) | |
| tree | c6dfbe912d888cca4bf4732a1882ab27643cb523 /tccrun.c | |
| parent | bfd1c08d6c579445fe75dd633fbd9b0757cea5d0 (diff) | |
| download | tinycc-02642bc94cb65a59a9eb95b8214bf66960ecde6e.tar.gz tinycc-02642bc94cb65a59a9eb95b8214bf66960ecde6e.tar.bz2 | |
lib/libtcc1.c: cleanup
- remove #include dependencies from libtcc1.c
for easier cross compilation
- clear_cache only on ARM
- error-message for mprotect failure
Diffstat (limited to 'tccrun.c')
| -rw-r--r-- | tccrun.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -255,7 +255,6 @@ static void set_pages_executable(void *ptr, unsigned long length) unsigned long old_protect; VirtualProtect(ptr, length, PAGE_EXECUTE_READWRITE, &old_protect); #else - extern void __clear_cache(void *beginning, void *end); #ifndef PAGESIZE # define PAGESIZE 4096 #endif @@ -263,12 +262,12 @@ static void set_pages_executable(void *ptr, unsigned long length) start = (addr_t)ptr & ~(PAGESIZE - 1); end = (addr_t)ptr + length; end = (end + PAGESIZE - 1) & ~(PAGESIZE - 1); - mprotect((void *)start, end - start, PROT_READ | PROT_WRITE | PROT_EXEC); - #ifndef __PCC__ - __clear_cache(ptr, (char *)ptr + length); - #else - /* pcc 1.2.0.DEVEL 20141206 don't have such proc */ - #endif + if (mprotect((void *)start, end - start, PROT_READ | PROT_WRITE | PROT_EXEC)) + tcc_error("mprotect failed: did you mean to configure --with-selinux?"); +#if defined TCC_TARGET_ARM || defined TCC_TARGET_ARM64 + { extern void __clear_cache(void *beginning, void *end); + __clear_cache(ptr, (char *)ptr + length); } +#endif #endif } |
