OpenBSD: use portable strtoll instead of strtonum to allow cross-compilation test

This commit is contained in:
Christian Jullien 2021-01-12 08:12:40 +01:00
parent 4d254312be
commit 00d467d44c
2 changed files with 9 additions and 7 deletions

View File

@ -1111,7 +1111,7 @@ ST_FUNC char *tcc_openbsd_library_soversion(TCCState *s, const char *libraryname
{ {
DIR *dirp; DIR *dirp;
struct dirent *dp; struct dirent *dp;
const char *e; char *e;
char **libpaths, *t, *u, *v; char **libpaths, *t, *u, *v;
char soname[1024]; char soname[1024];
long long maj, min, tmaj, tmin; 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 = strrchr(t, '.');
*u = '\0'; *u = '\0';
tmin = strtonum(u + 1, 0, LLONG_MAX, &e); tmin = strtoll(u + 1, &e, 10);
if (e != NULL) {
if (*e != 0) {
tcc_free(t); tcc_free(t);
t = NULL; t = NULL;
continue; continue;
} }
v = strrchr(t, '.'); v = strrchr(t, '.');
tmaj = strtonum(v + 1, 0, LLONG_MAX, &e); tmaj = strtoll(v + 1, &e, 10);
if (e != NULL) {
if (*e != 0) {
tcc_free(t); tcc_free(t);
t = NULL; t = NULL;
continue; continue;

View File

@ -2540,9 +2540,9 @@ static int elf_output_file(TCCState *s1, const char *filename)
struct ro_inf roinf; struct ro_inf roinf;
ElfW(Phdr) *phdr; ElfW(Phdr) *phdr;
Section *strsec, *interp, *dynamic, *dynstr, *note = NULL; Section *strsec, *interp, *dynamic, *dynstr, *note = NULL;
#ifndef ELF_OBJ_ONLY //#ifndef ELF_OBJ_ONLY
struct ro_inf *roinf_use = NULL; struct ro_inf *roinf_use = NULL;
#endif //#endif
file_type = s1->output_type; file_type = s1->output_type;