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

0% tests passed, 3 tests failed out of 3 #2

Open
dougmencken opened this issue Nov 6, 2018 · 2 comments
Open

0% tests passed, 3 tests failed out of 3 #2

dougmencken opened this issue Nov 6, 2018 · 2 comments

Comments

@dougmencken
Copy link

$ make test
Running tests...
/usr/bin/ctest --force-new-ctest-process
Test project /Volumes/hfsplushd/Development/gcc-toolchain/xtools-git-dougmencken/_build
    Start 1: check-x86-as
1/3 Test #1: check-x86-as .....................***Failed    0.11 sec
    Start 2: check-x86_86-as
2/3 Test #2: check-x86_86-as ..................***Failed    0.09 sec
    Start 3: check-ppc-as
3/3 Test #3: check-ppc-as .....................***Failed    0.07 sec

0% tests passed, 3 tests failed out of 3

Total Test time (real) =   0.32 sec

The following tests FAILED:
	  1 - check-x86-as (Failed)
	  2 - check-x86_86-as (Failed)
	  3 - check-ppc-as (Failed)
Errors while running CTest
make: *** [test] Error 8
@dougmencken
Copy link
Author

dougmencken commented Nov 6, 2018

That’s how I configure it

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/opt/xtools \
      -DCMAKE_C_COMPILER:STRING=/Developer/GCC/8.2p/PowerPC/32bit/bin/gcc \
      -DCMAKE_CXX_COMPILER:STRING=/Developer/GCC/8.2p/PowerPC/32bit/bin/g++ \
      -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=$(printf 10.%d `sw_vers -productVersion | cut -d . -f 2`) \
      -DCMAKE_C_FLAGS:STRING=-mmacosx-version-min=$(printf 10.%d `sw_vers -productVersion | cut -d . -f 2`) \
      -DCMAKE_CXX_FLAGS:STRING=-mmacosx-version-min=$(printf 10.%d `sw_vers -productVersion | cut -d . -f 2`) \
      ..

@iains
Copy link
Owner

iains commented Nov 7, 2018

Thanks for the report.

as noted in the build instructions:

"at present there's not a usable test-suite (although using the resulting tools to build GCC/LLVM is a fairly good test)." Actually, "fairly" is somewhat of an understatement - building a toolchain is an extensive use of the tool capabilities. The compiler test suite, in turn, exercises the assembler and linker.

So - the failures you see in attempting the ctest invocation are not, in themselves, significant

  • fixing up the test suite for 1.1 is probably not going to happen (since I have a pending update to 2.2.2, where it would be more productive to invest the time).

biergaizi referenced this issue in biergaizi/darwin-xtools Apr 25, 2023
In ar(1), strcmp() checks are used to determine the value
of argument argv[1], even when no argument is given. In the
past, they were possibly harmless out-of-bound reads and
comparison with garbage, without consequences.

However, running it on macOS 13 w/ Apple Silicon immediately
crashes it with Segmentation Fault, because argv[1] is now
NULL and generates EXC_BAD_ACCESS in strcmp().

This commit checks whether argc is equal or greater than 2
before doing strcmp().

$ ./bin/ar
Segmentation fault: 11

* thread grobian#1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000193181460 libsystem_platform.dylib`_platform_strcmp + 144
libsystem_platform.dylib`:
->  0x193181460 <+144>: ldr    q0, [x0], #0x10
    0x193181464 <+148>: ldr    q1, [x1], #0x10
    0x193181468 <+152>: cmeq.16b v1, v0, v1
    0x19318146c <+156>: and.16b v0, v0, v1
Target 0: (ar) stopped.
(lldb) bt
* thread grobian#1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000193181460 libsystem_platform.dylib`_platform_strcmp + 144
    frame grobian#1: 0x0000000100006440 ar`main(argc=1, argv=0x000000016fdfef58) at ar.c:126:8
    frame grobian#2: 0x0000000192e2be50 dyld`start + 2544

Signed-off-by: Yifeng Li <[email protected]>
biergaizi referenced this issue in biergaizi/darwin-xtools Apr 25, 2023
In ar(1), strcmp() checks are used to determine the value
of argument argv[1], even when no argument is given. In the
past, they were possibly harmless out-of-bound reads and
comparison with garbage, without consequences.

However, running it on macOS 13 w/ Apple Silicon immediately
crashes it with Segmentation Fault, because argv[1] is now
NULL and generates EXC_BAD_ACCESS in strcmp().

This commit checks whether argc is equal or greater than 2
before doing strcmp().

$ ./bin/ar
Segmentation fault: 11

* thread grobian#1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000193181460 libsystem_platform.dylib`_platform_strcmp + 144
libsystem_platform.dylib`:
->  0x193181460 <+144>: ldr    q0, [x0], #0x10
    0x193181464 <+148>: ldr    q1, [x1], #0x10
    0x193181468 <+152>: cmeq.16b v1, v0, v1
    0x19318146c <+156>: and.16b v0, v0, v1
Target 0: (ar) stopped.
(lldb) bt
* thread grobian#1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000193181460 libsystem_platform.dylib`_platform_strcmp + 144
    frame grobian#1: 0x0000000100006440 ar`main(argc=1, argv=0x000000016fdfef58) at ar.c:126:8
    frame grobian#2: 0x0000000192e2be50 dyld`start + 2544

Signed-off-by: Yifeng Li <[email protected]>
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

No branches or pull requests

2 participants