Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be explicit about OS version #179

Merged
merged 1 commit into from
Aug 18, 2023
Merged

Be explicit about OS version #179

merged 1 commit into from
Aug 18, 2023

Conversation

sevan
Copy link
Contributor

@sevan sevan commented Aug 11, 2023

via macports, allows pcre2 to build with jit support on OS X 10.4

via macports, allows pcre2 to build with jit support on OS X 10.4
Copy link
Contributor

@carenas carenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it safe to assume you tested the fallback works for PPC?

#elif defined __APPLE__
#elif defined __APPLE__ && \
defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ && \
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better to use the documented API for this with:

MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAC_OS_X_VERSION_10_5 is not going to be defined on 10.4, but I can compare to 1050 I guess.
I'll take a look and report back.

@sevan
Copy link
Contributor Author

sevan commented Aug 12, 2023

is it safe to assume you tested the fallback works for PPC?

Yes, I've been building on a G5.

@zherczeg
Copy link
Owner

Is this patch ok for landing? I have no mac at all.

@carenas
Copy link
Contributor

carenas commented Aug 17, 2023

the use of __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ which might be set by the compiler in that old OS but that is not the documented way of doing that check is a little hacky IMHO, but it is sure better than not being able to enable JIT because of a failed build.

Copy link
Owner

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zherczeg zherczeg merged commit 976e5d8 into zherczeg:master Aug 18, 2023
@sevan sevan deleted the master-1 branch August 18, 2023 06:02
@carenas
Copy link
Contributor

carenas commented Sep 26, 2023

is it safe to assume you tested the fallback works for PPC?

Yes, I've been building on a G5.

did you build it both as 32bit and 64bit and run sljit_test without errors for both?

@sevan
Copy link
Contributor Author

sevan commented Sep 26, 2023

No, 64bit powerpc builds on Tiger is a bit of a gamble and I never bother. Rode the defaults with 32bit build.

@carenas
Copy link
Contributor

carenas commented Oct 2, 2023

sljit code is fairly portable and doesn't have many dependencies, so it should build fine also in 64bit, and indeed it would be important to verify it works well for PPC with both.

@sevan
Copy link
Contributor Author

sevan commented Oct 2, 2023

It's more the case that on Tiger, it's really the kernel which has 64-bit support, most of the provided userland is 32-bit so it just ends up with broken builds. Just for background, I ended up here because of pcre2 with jit support btw.
I'll try the 64-bit build and report back over the next few days.

@carenas
Copy link
Contributor

carenas commented Oct 2, 2023

I ended up here because of pcre2 with jit support

PCRE2 only uses a subset of what sljit provides, for example with PowerPC, 32bit AIX is broken for sljit, but still has a working PCRE because floating point support is not needed.

Note also there is a proposed change on top of yours for the portability issue that was previously discussed.

@sevan
Copy link
Contributor Author

sevan commented Oct 2, 2023

With a latest clone of the repo, on OS X Leopard 10.5, attempting to build the "First Program" example from doc/tutorial/sljit_tutorial.html fails.
The error in the sample source aside, MAP_JIT was introduced between OS X 10.6 and 10.11. Checked and it's not defined in sys/mman.h on 10.6 but is on 10.11.

bash-3.2$ gcc -Wall -Isljit_src -DSLJIT_CONFIG_AUTO=1 my.c sljit_src/sljitLir.c -o program
my.c: In function 'add3':
my.c:15: error: too few arguments to function 'sljit_create_compiler'
my.c:40: warning: format '%ld' expects type 'long int', but argument 2 has type 'sljit_sw'
my.c:46: error: too few arguments to function 'sljit_free_code'
In file included from sljit_src/sljitLir.c:313:
sljit_src/allocator_src/sljitExecAllocatorApple.c: In function 'alloc_chunk':
sljit_src/allocator_src/sljitExecAllocatorApple.c:101: error: 'MAP_JIT' undeclared (first use in this function)
sljit_src/allocator_src/sljitExecAllocatorApple.c:101: error: (Each undeclared identifier is reported only once
sljit_src/allocator_src/sljitExecAllocatorApple.c:101: error: for each function it appears in.)
sljit_src/allocator_src/sljitExecAllocatorApple.c:107: warning: implicit declaration of function 'SLJIT_UPDATE_WX_FLAGS'

@sevan
Copy link
Contributor Author

sevan commented Oct 2, 2023

Running make in the root of the repo, results in

$ make 
cc  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror -c -o bin/sljitMain.o test_src/sljitMain.c
cc  -Isljit_src -DSLJIT_HAVE_CONFIG_PRE=1 -Itest_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror  bin/sljitMain.o test_src/sljitTest.c sljit_src/sljitLir.c -o bin/sljit_test -lm -lpthread 
cc1: warnings being treated as errors
test_src/sljitTest.c: In function 'test70':
test_src/sljitTest.c:7394: warning: passing argument 2 of 'code.test70_f3' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7421: warning: passing argument 1 of 'code.test70_f4' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7421: warning: passing argument 3 of 'code.test70_f4' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7449: warning: passing argument 2 of 'code.test70_f5' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7449: warning: passing argument 4 of 'code.test70_f5' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7476: warning: passing argument 3 of 'code.test70_f6' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7503: warning: passing argument 1 of 'code.test70_f7' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c: In function 'test71':
test_src/sljitTest.c:7806: warning: passing argument 1 of 'code.test71_f1' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c: In function 'test93':
test_src/sljitTest.c:11968: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:11970: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:11972: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:11974: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:11976: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c: In function 'test96':
test_src/sljitTest.c:12374: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12375: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12376: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12377: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12378: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12379: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12380: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12381: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12382: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12383: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12384: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12385: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12386: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12387: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12388: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12389: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12390: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12505: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12506: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12507: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12508: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12509: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12510: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12511: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12516: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12517: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12518: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12525: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12526: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c: In function 'test103':
test_src/sljitTest.c:14535: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
cc1: warnings being treated as errors
In file included from sljit_src/sljitLir.c:286:
sljit_src/sljitUtils.c: In function 'sljit_allocate_stack':
sljit_src/sljitUtils.c:275: warning: passing argument 6 of 'mmap' with different width due to prototype
In file included from sljit_src/sljitLir.c:313:
sljit_src/allocator_src/sljitExecAllocatorApple.c: In function 'alloc_chunk':
sljit_src/allocator_src/sljitExecAllocatorApple.c:101: error: 'MAP_JIT' undeclared (first use in this function)
sljit_src/allocator_src/sljitExecAllocatorApple.c:101: error: (Each undeclared identifier is reported only once
sljit_src/allocator_src/sljitExecAllocatorApple.c:101: error: for each function it appears in.)
sljit_src/allocator_src/sljitExecAllocatorApple.c:103: warning: passing argument 6 of 'mmap' with different width due to prototype
sljit_src/allocator_src/sljitExecAllocatorApple.c:107: warning: implicit declaration of function 'SLJIT_UPDATE_WX_FLAGS'
In file included from sljit_src/sljitLir.c:3002:
sljit_src/sljitNativePPC_common.c: In function 'sljit_emit_fset32':
sljit_src/sljitNativePPC_common.c:2322: warning: passing argument 3 of 'check_sljit_emit_fset32' as 'float' rather than 'double' due to prototype
make: *** [bin/sljit_test] Error 1

@sevan
Copy link
Contributor Author

sevan commented Oct 2, 2023

Building with GCC 7.5.0 on Leopard, there's a little less noise.

gcc-7  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror -c -o bin/sljitMain.o test_src/sljitMain.c
gcc-7  -Isljit_src -DSLJIT_HAVE_CONFIG_PRE=1 -Itest_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror  bin/sljitMain.o test_src/sljitTest.c sljit_src/sljitLir.c -o bin/sljit_test -lm -lpthread 
In file included from sljit_src/sljitLir.c:313:0:
sljit_src/allocator_src/sljitExecAllocatorApple.c: In function 'alloc_chunk':
sljit_src/allocator_src/sljitExecAllocatorApple.c:91:24: error: 'MAP_JIT' undeclared (first use in this function); did you mean 'MAP_FILE'?
 #define SLJIT_MAP_JIT (MAP_JIT)
                        ^
sljit_src/allocator_src/sljitExecAllocatorApple.c:101:22: note: in expansion of macro 'SLJIT_MAP_JIT'
  flags |= MAP_ANON | SLJIT_MAP_JIT;
                      ^~~~~~~~~~~~~
sljit_src/allocator_src/sljitExecAllocatorApple.c:91:24: note: each undeclared identifier is reported only once for each function it appears in
 #define SLJIT_MAP_JIT (MAP_JIT)
                        ^
sljit_src/allocator_src/sljitExecAllocatorApple.c:101:22: note: in expansion of macro 'SLJIT_MAP_JIT'
  flags |= MAP_ANON | SLJIT_MAP_JIT;
                      ^~~~~~~~~~~~~
sljit_src/allocator_src/sljitExecAllocatorApple.c:107:2: error: implicit declaration of function 'SLJIT_UPDATE_WX_FLAGS'; did you mean 'SLJIT_SET_F_LESS'? [-Werror=implicit-function-declaration]
  SLJIT_UPDATE_WX_FLAGS(retval, (uint8_t *)retval + size, 0);
  ^~~~~~~~~~~~~~~~~~~~~
  SLJIT_SET_F_LESS
cc1: all warnings being treated as errors
make: *** [bin/sljit_test] Error 1

@carenas
Copy link
Contributor

carenas commented Oct 3, 2023

make: *** [bin/sljit_test] Error 1

Not sure how it worked before, but it sure needs at least #214

Running make should generate bin/sljit_test and bin/regex_test which would confirm support, remember to make clean and. build with -m64 if possible after.

to avoid warnings breaking the build could use make WERROR=; thanks for your help

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

With GCC 4.2, it barfs on linking

Undefined symbols:
  "_SLJIT_UPDATE_WX_FLAGS", referenced from:
      _sljit_malloc_exec in ccpklBoC.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [bin/sljit_test] Error 1

With GCC 7

gcc-7  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror -c -o bin/sljitMain.o test_src/sljitMain.c
gcc-7  -Isljit_src -DSLJIT_HAVE_CONFIG_PRE=1 -Itest_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror  bin/sljitMain.o test_src/sljitTest.c sljit_src/sljitLir.c -o bin/sljit_test -lm -lpthread 
In file included from sljit_src/sljitLir.c:313:0:
sljit_src/allocator_src/sljitExecAllocatorApple.c: In function 'alloc_chunk':
sljit_src/allocator_src/sljitExecAllocatorApple.c:123:2: error: implicit declaration of function 'SLJIT_UPDATE_WX_FLAGS'; did you mean 'SLJIT_SET_F_LESS'? [-Werror=implicit-function-declaration]
  SLJIT_UPDATE_WX_FLAGS(retval, (uint8_t *)retval + size, 0);
  ^~~~~~~~~~~~~~~~~~~~~
  SLJIT_SET_F_LESS
cc1: all warnings being treated as errors
make: *** [bin/sljit_test] Error 1

@carenas
Copy link
Contributor

carenas commented Oct 3, 2023

Ok, that means that you don't have a definition for TARGET_OS_OSX and now we had make it more likely to have a broken sljit in iOS.

Can you try the latest version (76b16be) of that PR?

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

That compiled.
With GCC 4.2

gcc-4.2  -Isljit_src -DSLJIT_HAVE_CONFIG_PRE=1 -Itest_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement   bin/sljitMain.o test_src/sljitTest.c sljit_src/sljitLir.c -o bin/sljit_test -lm -lpthread 
test_src/sljitTest.c: In function 'test70':
test_src/sljitTest.c:7394: warning: passing argument 2 of 'code.test70_f3' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7421: warning: passing argument 1 of 'code.test70_f4' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7421: warning: passing argument 3 of 'code.test70_f4' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7449: warning: passing argument 2 of 'code.test70_f5' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7449: warning: passing argument 4 of 'code.test70_f5' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7476: warning: passing argument 3 of 'code.test70_f6' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:7503: warning: passing argument 1 of 'code.test70_f7' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c: In function 'test71':
test_src/sljitTest.c:7806: warning: passing argument 1 of 'code.test71_f1' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c: In function 'test93':
test_src/sljitTest.c:11968: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:11970: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:11972: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:11974: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c:11976: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
test_src/sljitTest.c: In function 'test96':
test_src/sljitTest.c:12374: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12375: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12376: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12377: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12378: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12379: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12380: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12381: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12382: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12383: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12384: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12385: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12386: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12387: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12388: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12389: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12390: warning: passing argument 2 of 'simd_set' with different width due to prototype
test_src/sljitTest.c:12505: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12506: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12507: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12508: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12509: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12510: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12511: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12516: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12517: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12518: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12525: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c:12526: warning: passing argument 2 of 'check_simd_mov' with different width due to prototype
test_src/sljitTest.c: In function 'test103':
test_src/sljitTest.c:14535: warning: passing argument 3 of 'sljit_emit_fset32' as 'float' rather than 'double' due to prototype
In file included from sljit_src/sljitLir.c:286:
sljit_src/sljitUtils.c: In function 'sljit_allocate_stack':
sljit_src/sljitUtils.c:275: warning: passing argument 6 of 'mmap' with different width due to prototype
In file included from sljit_src/sljitLir.c:313:
sljit_src/allocator_src/sljitExecAllocatorApple.c: In function 'alloc_chunk':
sljit_src/allocator_src/sljitExecAllocatorApple.c:120: warning: passing argument 6 of 'mmap' with different width due to prototype
In file included from sljit_src/sljitLir.c:3002:
sljit_src/sljitNativePPC_common.c: In function 'sljit_emit_fset32':
sljit_src/sljitNativePPC_common.c:2322: warning: passing argument 3 of 'check_sljit_emit_fset32' as 'float' rather than 'double' due to prototype
gcc-4.2  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement  -fshort-wchar -c -o bin/regexMain.o regex_src/regexMain.c
gcc-4.2  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement  -fshort-wchar -c -o bin/regexJIT.o regex_src/regexJIT.c
gcc-4.2  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement  -c -o bin/sljitLir.o sljit_src/sljitLir.c
In file included from sljit_src/sljitLir.c:286:
sljit_src/sljitUtils.c: In function 'sljit_allocate_stack':
sljit_src/sljitUtils.c:275: warning: passing argument 6 of 'mmap' with different width due to prototype
In file included from sljit_src/sljitLir.c:313:
sljit_src/allocator_src/sljitExecAllocatorApple.c: In function 'alloc_chunk':
sljit_src/allocator_src/sljitExecAllocatorApple.c:120: warning: passing argument 6 of 'mmap' with different width due to prototype
In file included from sljit_src/sljitLir.c:3002:
sljit_src/sljitNativePPC_common.c: In function 'sljit_emit_fset32':
sljit_src/sljitNativePPC_common.c:2322: warning: passing argument 3 of 'check_sljit_emit_fset32' as 'float' rather than 'double' due to prototype
gcc-4.2 -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement   bin/regexMain.o bin/regexJIT.o bin/sljitLir.o -o bin/regex_test -lm -lpthread
Run executable allocator test
Run test1
Run test2
Run test3
Run test4
Run test5
Run test6
Run test7
Run test8
Run test9
Run test10
Run test11
Run test12
Run test13
Run test14
Run test15
Run test16
Run test17
Run test18
Run test19
Run test20
Run test21
Run test22
Run test23
Run test24
Run test26
Run test27
Run test28
Run test29
Run test30
Run test31
Run test32
Run test33
Run test34
Run test35
Run test36
Run test37
Run test38
Run test39
Run test40
Run test41
Run test42
Run test43
Run test44
Run test45
Run test46
Run test47
Run test48
Run test49
Run test50
Run test51
Run test52
Run test53
Run test54
Run test55
Run test56
Run test57
Run test58
test58 case 4 failed
Run test59
test59 case 4 failed
Run test60
Run test61
Run test62
Run test63
Run test64
Run test65
Run test66
Run test67
Run test68
Run test69
Run test70
test70 case 9 failed
Run test71
test71 case 9 failed
Run test72
Run test73
test73 case 17 failed
Run test74
Run test75
Run test76
Run test77
Run test78
Run test79
Run test80
Run test81
Run test82
Run test83
Run test84
Run test85
Run test86
Run test87
Run test88
Run test89
Run test90
Run test91
Run test93
Run test94
Run test95
Run test96
no simd available, test96 skipped
Run test97
no simd available, test97 skipped
Run test98
no simd available, test98 skipped
Run test99
no simd available, test99 skipped
Run test100
no simd available, test100 skipped
Run test101
no simd available, test101 skipped
Run test102
no simd available, test102 skipped
Run test103
f32 register pairs are not available, test103 skipped
SLJIT tests: 5 (4%) tests FAILED on PowerPC 32bit (big endian + unaligned) (with fpu)
REGEX tests: all tests PASSED on PowerPC 32bit (big endian + unaligned)

With GCC 7

gcc-7  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror -c -o bin/sljitMain.o test_src/sljitMain.c
gcc-7  -Isljit_src -DSLJIT_HAVE_CONFIG_PRE=1 -Itest_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror  bin/sljitMain.o test_src/sljitTest.c sljit_src/sljitLir.c -o bin/sljit_test -lm -lpthread 
gcc-7  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror -fshort-wchar -c -o bin/regexMain.o regex_src/regexMain.c
gcc-7  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror -fshort-wchar -c -o bin/regexJIT.o regex_src/regexJIT.c
gcc-7  -Isljit_src -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror -c -o bin/sljitLir.o sljit_src/sljitLir.c
gcc-7 -O2 -Wall -Wextra -Wconversion -Wsign-compare -Wdeclaration-after-statement -Werror  bin/regexMain.o bin/regexJIT.o bin/sljitLir.o -o bin/regex_test -lm -lpthread 

Running the test binaries

Run executable allocator test
Run test1
Run test2
Run test3
Run test4
Run test5
Run test6
Run test7
Run test8
Run test9
Run test10
Run test11
Run test12
Run test13
Run test14
Run test15
Run test16
Run test17
Run test18
Run test19
Run test20
Run test21
Run test22
Run test23
Run test24
Run test26
Run test27
Run test28
Run test29
Run test30
Run test31
Run test32
Run test33
Run test34
Run test35
Run test36
Run test37
Run test38
Run test39
Run test40
Run test41
Run test42
Run test43
Run test44
Run test45
Run test46
Run test47
Run test48
Run test49
Run test50
Run test51
Run test52
Run test53
Run test54
Run test55
Run test56
Run test57
Run test58
test58 case 4 failed
Run test59
test59 case 4 failed
Run test60
Run test61
Run test62
Run test63
Run test64
Run test65
Run test66
Run test67
Run test68
Run test69
Run test70
test70 case 9 failed
Run test71
test71 case 9 failed
Run test72
Run test73
test73 case 17 failed
Run test74
Run test75
Run test76
Run test77
Run test78
Run test79
Run test80
Run test81
Run test82
Run test83
Run test84
Run test85
Run test86
Run test87
Run test88
Run test89
Run test90
Run test91
Run test93
Run test94
Run test95
Run test96
no simd available, test96 skipped
Run test97
no simd available, test97 skipped
Run test98
no simd available, test98 skipped
Run test99
no simd available, test99 skipped
Run test100
no simd available, test100 skipped
Run test101
no simd available, test101 skipped
Run test102
no simd available, test102 skipped
Run test103
f32 register pairs are not available, test103 skipped
SLJIT tests: 5 (4%) tests FAILED on PowerPC 32bit (big endian + unaligned) (with fpu)
REGEX tests: all tests PASSED on PowerPC 32bit (big endian + unaligned)

@carenas
Copy link
Contributor

carenas commented Oct 3, 2023

OK, so that means (as I suspected originally) that macOS uses the same ABI than AIX and is therefore as broken at least in 32bit.

The fix is in #211, if you are interested.

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

I applied the patch but same tests are failing.

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

Ah, #if (defined(SLJIT_CONFIG_PPC_64) && SLJIT_CONFIG_PPC_64) || defined(_AIX) the guards are for 64bit PowerPC & AIX. Needs to accommodate OS X too?

@carenas
Copy link
Contributor

carenas commented Oct 3, 2023

Needs to accommodate OS X too?

At least, I am also wondering if it might be also needed for some of the BSD; eitherway latest version might work.

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

That worked for 32-bit build using GCC 4.2 & GCC 7.5.0

SLJIT tests: all tests PASSED on PowerPC 32bit (big endian + unaligned) (with fpu)
REGEX tests: all tests PASSED on PowerPC 32bit (big endian + unaligned)

Now to try the 64-bit build.

@carenas
Copy link
Contributor

carenas commented Oct 3, 2023

Now to try the 64-bit build

the simplest is to run make CC='gcc -m64' if your compiler supports multilib

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

Doesn't work, GCC 4.2 dumps out lots of warnings about different width due to prototype like warning: passing argument 1 of '__builtin_expect' with different width due to prototype
Then the resulting sljit_test binary crashes with

Pass -v to enable verbose, -s to disable this hint.

Illegal instruction

regex_test crashes with

Pass -v to enable verbose, -s to disable this hint.

Bus error

Can't test with GCC 7.5.0 because my build is missing required architecture ppc64 in file for things like libgcc, so it chokes on linking.

@carenas
Copy link
Contributor

carenas commented Oct 3, 2023

Illegal instruction

interesting, if you run it with -v does it show a specific test being at fault?

running it under gdb would let you see exactly where it crashes and disassemble the instructions with x/32i $pc - 4

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

Run executable allocator test
Run test1
Illegal instruction
Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand.
0x000000010005b060 in ?? ()
(gdb) x/32i $pc - 4
0x10005b05c:	blr
0x10005b060:	.long 0x1
0x10005b064:	.long 0x5b010
0x10005b068:	std     r31,-8(r1)
0x10005b06c:	mfcr    r2
0x10005b070:	bcl-    20,4*cr7+so,0x10005b074
0x10005b074:	std     r18,-112(r1)
0x10005b078:	.long 0x0
0x10005b07c:	.long 0x0
0x10005b080:	.long 0x0
0x10005b084:	.long 0x78
0x10005b088:	.long 0x0
0x10005b08c:	.long 0x0
0x10005b090:	.long 0x0
0x10005b094:	.long 0x0
0x10005b098:	.long 0x0
0x10005b09c:	.long 0xff78
0x10005b0a0:	.long 0x0
0x10005b0a4:	.long 0x0
0x10005b0a8:	.long 0x0
0x10005b0ac:	.long 0x0
0x10005b0b0:	.long 0x0
0x10005b0b4:	.long 0x0
0x10005b0b8:	.long 0x0
0x10005b0bc:	.long 0x0
0x10005b0c0:	.long 0x0
0x10005b0c4:	.long 0x0
0x10005b0c8:	.long 0x0
0x10005b0cc:	.long 0x0
0x10005b0d0:	.long 0x0
0x10005b0d4:	.long 0x0
0x10005b0d8:	.long 0x0

Stepping away for the day.

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

Checked out the repo on a G4 running 10.4 and with the patches from 211 & 214 PRs, sljit_test & regex_test build and pass fine using GCC 4.0.1. Previous reports were on a G5 running 10.5.

@carenas
Copy link
Contributor

carenas commented Oct 3, 2023

build and pass fine

just to be clear, this was 32bit only, correct?

also curious if the last changes to #211 fix 64bit?

the previous error pointed to OSX not using the indirect calls that AIX and 64bit big endian Linux uses.

@sevan
Copy link
Contributor Author

sevan commented Oct 3, 2023

correct, 32bit build on G4 which is a 32bit CPU.
Just fetched the patch from PR 211 and that seems to work on a G5 running Leopard, when built with GCC 4.2

SLJIT tests: all tests PASSED on PowerPC 64bit (big endian + unaligned) (with fpu)
REGEX tests: all tests PASSED on PowerPC 64bit (big endian + unaligned)

@barracuda156
Copy link

It's more the case that on Tiger, it's really the kernel which has 64-bit support, most of the provided userland is 32-bit so it just ends up with broken builds

It is the opposite in fact. xnu has never been 64-bit on powerpc, but userland supported ppc64. However, AFAIK, that holds only for 10.5; on 10.4 support, even if present to some extent, is incomplete, and in 10.6 it was removed. So the only meaningful config for ppc64 is 10.5.8.
ppc (32-bit) can be tested on all three though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants