From 00d467d44c53d0e2bea61649c2e48b3d5af74c45 Mon Sep 17 00:00:00 2001 From: Christian Jullien Date: Tue, 12 Jan 2021 08:12:40 +0100 Subject: [PATCH] OpenBSD: use portable strtoll instead of strtonum to allow cross-compilation test --- libtcc.c | 12 +++++++----- tccelf.c | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libtcc.c b/libtcc.c index f26c5dfb..2f46e0aa 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1111,7 +1111,7 @@ ST_FUNC char *tcc_openbsd_library_soversion(TCCState *s, const char *libraryname { DIR *dirp; struct dirent *dp; - const char *e; + char *e; char **libpaths, *t, *u, *v; char soname[1024]; long long maj, min, tmaj, tmin; @@ -1134,16 +1134,18 @@ ST_FUNC char *tcc_openbsd_library_soversion(TCCState *s, const char *libraryname u = strrchr(t, '.'); *u = '\0'; - tmin = strtonum(u + 1, 0, LLONG_MAX, &e); - if (e != NULL) { + tmin = strtoll(u + 1, &e, 10); + + if (*e != 0) { tcc_free(t); t = NULL; continue; } v = strrchr(t, '.'); - tmaj = strtonum(v + 1, 0, LLONG_MAX, &e); - if (e != NULL) { + tmaj = strtoll(v + 1, &e, 10); + + if (*e != 0) { tcc_free(t); t = NULL; continue; diff --git a/tccelf.c b/tccelf.c index 3bff77e8..9772ab6a 100644 --- a/tccelf.c +++ b/tccelf.c @@ -2540,9 +2540,9 @@ static int elf_output_file(TCCState *s1, const char *filename) struct ro_inf roinf; ElfW(Phdr) *phdr; Section *strsec, *interp, *dynamic, *dynstr, *note = NULL; -#ifndef ELF_OBJ_ONLY +//#ifndef ELF_OBJ_ONLY struct ro_inf *roinf_use = NULL; -#endif +//#endif file_type = s1->output_type;