From e411099a0cebec119bb198789a2655632cfdabfb01bbe11144bc34eb0e08dc8e Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Mon, 20 May 2019 12:36:04 +0000 Subject: [PATCH] Reenable ARM_COMPLIANT=1 on ARM but fix the memory errors OBS-URL: https://build.opensuse.org/package/show/Publishing:TeXLive/texlive?expand=0&rev=318 --- source.dif | 210 ++++++++++++++++++++++++++++++++++++++++++------ texlive.changes | 5 ++ 2 files changed, 189 insertions(+), 26 deletions(-) diff --git a/source.dif b/source.dif index e691f28..2c03510 100644 --- a/source.dif +++ b/source.dif @@ -22,14 +22,16 @@ texk/texlive/tl_scripts/texconfig.sh | 35 --- texk/texlive/tl_scripts/texlinks.sh | 53 +++- texk/web2c/Makefile.in | 7 - texk/web2c/luatexdir/luapplib/ppconf.h | 2 + texk/web2c/luatexdir/image/pdftoepdf.c | 1 + texk/web2c/luatexdir/luapplib/ppheap.c | 60 ++--- + texk/web2c/luatexdir/luapplib/ppload.c | 4 texk/web2c/uptexdir/tests/gkhugeng.err | 8 texk/web2c/window/regis.c | 8 texk/web2c/window/x11-Xlib.c | 8 texk/web2c/window/x11-Xt.c | 4 texk/xdvik/psgs.c | 22 + texk/xdvik/xdvi-sh.in | 19 + - 30 files changed, 358 insertions(+), 162 deletions(-) + 32 files changed, 393 insertions(+), 190 deletions(-) --- libs/icu/icu-src/source/common/Makefile.in +++ libs/icu/icu-src/source/common/Makefile.in 2018-04-10 09:02:17.774983801 +0000 @@ -1002,20 +1004,6 @@ test "x$fmt" = "x$engine" && continue if test -f "$d/$engine$exeext"; then case $unlink in ---- texk/web2c/uptexdir/tests/gkhugeng.err -+++ texk/web2c/uptexdir/tests/gkhugeng.err 2019-05-13 11:22:35.158192154 +0000 -@@ -1,3 +1,11 @@ -+warning: kpathsea: /etc/texmf/ls-R: No usable entries in ls-R. -+warning: kpathsea: See the manual for how to generate ls-R. -+warning: kpathsea: /var/lib/texmf/ls-R: No usable entries in ls-R. -+warning: kpathsea: See the manual for how to generate ls-R. -+warning: kpathsea: /usr/share/texmf/ls-R: No usable entries in ls-R. -+warning: kpathsea: See the manual for how to generate ls-R. -+warning: kpathsea: /var/cache/texmf/fonts/ls-R: No usable entries in ls-R. -+warning: kpathsea: See the manual for how to generate ls-R. - Input file is in YOKO-kumi kanji tfm format. - The fifth byte of the input file exceeds 127! - Sorry, but I can't go on; are you sure this is a TFM? --- texk/web2c/Makefile.in +++ texk/web2c/Makefile.in 2018-04-10 09:02:17.870981997 +0000 @@ -4947,7 +4947,7 @@ libmd5_a_SOURCES = libmd5/md5.c libmd5/m @@ -1039,17 +1027,187 @@ $(srcdir)/c-auto.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f w2c/stamp-h1 ---- texk/web2c/luatexdir/luapplib/ppconf.h -+++ texk/web2c/luatexdir/luapplib/ppconf.h 2019-05-17 13:32:56.703733409 +0000 -@@ -4,7 +4,7 @@ +--- texk/web2c/luatexdir/image/pdftoepdf.c ++++ texk/web2c/luatexdir/image/pdftoepdf.c 2019-05-20 11:45:50.307508800 +0000 +@@ -73,6 +73,7 @@ + } + tmp.file_path = file_path; + pdf_doc = (PdfDocument *) avl_find(PdfDocumentTree, &tmp); ++ pdf_doc->memstream = NULL; /* Not initialized in line 1048: deletePdfDocumentPdfDoc() */ + return pdf_doc; + } - //#include "utilarm.h" // keep in sync - #if defined __arm__ || defined __ARM__ || defined ARM || defined __ARM || defined __arm || defined __ARM_ARCH ||defined __aarch64__ ||( defined(__sun) && defined(__SVR4)) --# define ARM_COMPLIANT 1 -+# define ARM_COMPLIANT 0 - #else - # define ARM_COMPLIANT 0 - #endif +--- texk/web2c/luatexdir/luapplib/ppheap.c ++++ texk/web2c/luatexdir/luapplib/ppheap.c 2019-05-20 12:04:35.067508800 +0000 +@@ -101,21 +101,25 @@ + #endif + + typedef struct _simplereg { ++ int heap_instance; + int bucket_pos; + size_t bucket_size; +- int heap_instance; +- aligned_data **align_data_set ; +-} simplereg; ++ union { ++ void *_area; ++ aligned_data **_set; ++ } align_data __attribute__ ((aligned(__alignof__(void*)))); ++} simplereg __attribute__ ((aligned(__alignof__(void*)))); + + /* By default static vars are initialized to NULL, but to be clear.. */ + static simplereg *align_set = NULL ; + + static void align_init_set(void){ + size_t size ; ++ int p; + + if (align_set) { + align_set->heap_instance++; +- return ; ++ return; + } + + align_set = malloc(sizeof(simplereg)); +@@ -125,8 +129,8 @@ + } + + size = SIZE_OF_POINTER*ALIGN_BUFF_BUCKET_SIZE; +- align_set->align_data_set = malloc(size); +- if (!align_set->align_data_set) { ++ align_set->align_data._area = malloc(size); ++ if (!align_set->align_data._area) { + fprintf(stderr,"! fatal error: unable to setup register for aligned pointers\n"); + exit(EXIT_FAILURE); + } +@@ -134,37 +138,40 @@ + align_set->bucket_pos = 0; + align_set->bucket_size = ALIGN_BUFF_BUCKET_SIZE; + align_set->heap_instance = 1; +- memset(align_set->align_data_set, 0,size); ++ memset(align_set->align_data._area, 0, size); ++ p = align_set->bucket_size; ++ while (p-- > 0){ ++ align_set->align_data._set[p] = NULL; ++ } + } + + static void align_save_into_set(aligned_data *p){ + if (align_set->bucket_pos >= align_set->bucket_size) { + size_t new_size; +- aligned_data **align_data_set_new; ++ void *align_data_area_new; + +- if(!align_set->align_data_set){ ++ if(!align_set->align_data._area){ + fprintf(stderr,"! fatal error: unable to save aligned pointer,corrupted set\n"); + exit(EXIT_FAILURE); + } + new_size = (ALIGN_BUFF_BUCKET_SIZE+align_set->bucket_size)*SIZE_OF_POINTER; +- align_data_set_new = malloc(new_size); +- if (!align_data_set_new) { ++ align_data_area_new = malloc(new_size); ++ if (!align_data_area_new) { + fprintf(stderr,"! fatal error: unable to save aligned pointer\n"); + exit(EXIT_FAILURE); + } +- memset(align_data_set_new,0,new_size); +- memcpy(align_data_set_new, align_set->align_data_set, align_set->bucket_size*SIZE_OF_POINTER); +- free(align_set->align_data_set); +- align_set->align_data_set = align_data_set_new ; ++ memset(align_data_area_new,0,new_size); ++ memcpy(align_data_area_new, align_set->align_data._area, align_set->bucket_size*SIZE_OF_POINTER); ++ free(align_set->align_data._area); ++ align_set->align_data._area = align_data_area_new ; + align_set->bucket_size += ALIGN_BUFF_BUCKET_SIZE; + } + if (align_set->bucket_pos>align_set->bucket_size){ + fprintf(stderr,"! fatal error: unable to save aligned pointer, wrong position\n"); + exit(EXIT_FAILURE); + } +- align_set->align_data_set[align_set->bucket_pos] = p ; ++ align_set->align_data._set[align_set->bucket_pos] = p ; + align_set->bucket_pos++; +- + } + + static void align_free_set(void){ +@@ -174,16 +181,16 @@ + if (align_set->heap_instance>1) { + align_set->heap_instance--; + } else if (align_set->heap_instance ==1) { +- if (align_set->align_data_set){ +- int p; +- for(p=1;pbucket_pos;p++){ +- aligned_data *ptr = align_set->align_data_set[p]; +- if (ptr) { +- free(ptr); ++ if (align_set->align_data._area){ ++ int p = align_set->bucket_pos; ++ while (p-- > 0){ /* Do not leak allocated mem address on subscript 0 */ ++ if (align_set->align_data._set[p]) { ++ free(align_set->align_data._set[p]); ++ align_set->align_data._set[p] = NULL; + } + } +- free(align_set->align_data_set); +- align_set->align_data_set = NULL; ++ free(align_set->align_data._area); ++ align_set->align_data._area = NULL; + } + align_set->heap_instance=0; + free(align_set); +@@ -226,7 +233,6 @@ + #ifdef PPHEAP_NEED_ALIGNMENT + align_free_set(); + #endif +- + } + + void ppheap_renew (ppheap *heap) +@@ -416,7 +422,7 @@ + // iof_close(O); + #ifdef PPHEAP_NEED_ALIGNMENT + /* Todo: only if data%sizeof(aligned_data) != 0 */ +- p_aligned_data = malloc(size); ++ p_aligned_data = (aligned_data*)malloc(size); + if (!p_aligned_data) { + fprintf(stderr,"! fatal error: unable to setup aligned pointer for ppheap_flush\n"); + exit(EXIT_FAILURE); +--- texk/web2c/luatexdir/luapplib/ppload.c ++++ texk/web2c/luatexdir/luapplib/ppload.c 2019-05-20 11:59:47.417508800 +0000 +@@ -60,7 +60,7 @@ + ghost->size = siz - sizeof(_ppname) - 1, \ + (ppname)(ghost + 1)) + +-#if ARM_COMPLAINT ++#if ARM_COMPLIANT + #define ppname_flush_with_ego(O, ghost, siz, flgs) \ + (iof_put(O, '\0'), \ + pad=(O->pos - pos_begin)%(sizeof(ppname*)), \ +@@ -270,7 +270,7 @@ + + + +-#if ARM_COMPLIANT ++#if 0 // ARM_COMPLIANT /* Invalid write of size 8 */ + #define ppstring_set_alter_ego(string, ghost, ego) do{ \ + size_t t = ((ghost)->size + 1); \ + t = (t%sizeof(ppstring *))==0?t: (t/sizeof(ppstring *)+1)*sizeof(ppstring *); \ +--- texk/web2c/uptexdir/tests/gkhugeng.err ++++ texk/web2c/uptexdir/tests/gkhugeng.err 2019-05-13 11:22:35.158192154 +0000 +@@ -1,3 +1,11 @@ ++warning: kpathsea: /etc/texmf/ls-R: No usable entries in ls-R. ++warning: kpathsea: See the manual for how to generate ls-R. ++warning: kpathsea: /var/lib/texmf/ls-R: No usable entries in ls-R. ++warning: kpathsea: See the manual for how to generate ls-R. ++warning: kpathsea: /usr/share/texmf/ls-R: No usable entries in ls-R. ++warning: kpathsea: See the manual for how to generate ls-R. ++warning: kpathsea: /var/cache/texmf/fonts/ls-R: No usable entries in ls-R. ++warning: kpathsea: See the manual for how to generate ls-R. + Input file is in YOKO-kumi kanji tfm format. + The fifth byte of the input file exceeds 127! + Sorry, but I can't go on; are you sure this is a TFM? --- texk/web2c/window/regis.c +++ texk/web2c/window/regis.c 2018-04-10 09:02:17.870981997 +0000 @@ -64,12 +64,14 @@ void mf_regis_blankrectangle (screencol diff --git a/texlive.changes b/texlive.changes index 928e039..ede2d16 100644 --- a/texlive.changes +++ b/texlive.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon May 20 12:31:56 UTC 2019 - Dr. Werner Fink + +- Reenable ARM_COMPLIANT=1 on ARM but fix the memory errors + ------------------------------------------------------------------- Fri May 17 13:38:23 UTC 2019 - Dr. Werner Fink