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

Inconsistent tst-unwind-main/ctor (check-glibc) results depending on build order #1379

Closed
ishitatsuyuki opened this issue Nov 28, 2023 · 2 comments · Fixed by #1380
Closed

Comments

@ishitatsuyuki
Copy link
Contributor

riscv-gnu-toolchain version: 8e9fb09

The tst-unwind-main and tst-unwind-ctor tests in glibc seems to exhibit inconsistent results depending on how the build is done.

If I run check-glibc-linux directly: The two tests fails.
broken.zip

If I run check-linux first and then run check-glibc-linux: The two tests passes.
pass.zip

The attached files are the compiled binaries for the two tests respectively.

It's puzzling why this can happen; maybe the build order is not as expected and there's some stage1/stage2 mixup?

@cmuellner
Copy link
Collaborator

Two different test suites are not expected to influence each other.

I just had a quick look at the disassembly of your attached files (specifically into tst-unwind-ctor-lib.so).
I noticed that uw_install_context_1 ends with jal ra,8c0 <abort@plt> in the good case and with ebreak in the bad case.

Further analysis with readelf showed that the good shared object has references to pthread symbols (e.g. __pthread_key_create@GLIBC_2.34), while the bad one does not have.

Also local symbols like version_lock_loc[...] don't exist in the bad SO.

I believe that we have a missing dependency for the check-glibc-linux target in Makefile.in for stage2 (as you already guessed). Please try this:

diff --git a/Makefile.in b/Makefile.in
index ae61d31..751b9d5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1001,7 +1001,8 @@ stamps/check-gcc-linux: stamps/build-gcc-linux-stage2 $(SIM_STAMP) stamps/build-
        mkdir -p $(dir $@)
        date > $@
 
-stamps/check-glibc-linux-%: $(addprefix stamps/build-glibc-linux-,$(GLIBC_MULTILIB_NAMES))
+stamps/check-glibc-linux-%: stamps/build-gcc-linux-stage2 $(SIM_STAMP) stamps/build-dejagnu \
+               $(addprefix stamps/build-glibc-linux-,$(GLIBC_MULTILIB_NAMES))
        $(eval $@_BUILD_DIR := $(notdir $@))
        $(eval $@_BUILD_DIR := $(subst check-,build-,$($@_BUILD_DIR)))
        $(SIM_PREPARE) $(MAKE) -C $($@_BUILD_DIR) check

If it works, then please file a PR.

ishitatsuyuki added a commit to ishitatsuyuki/riscv-gnu-toolchain that referenced this issue Nov 28, 2023
Some glibc tests like tst-unwind-{main,ctor} depends on stage2 artifacts
(in particular, GCC runtime libs) to be properly installed. Add stage2
dependencies to avoid these tests from spuriously failing.

The test suite also uses the simulator and Deja GNU, both of which were
not declared as dependencies, so add them as well.

Closes: riscv-collab#1379
@ishitatsuyuki
Copy link
Contributor Author

Thanks, that works. I filed #1380.

ishitatsuyuki added a commit to ishitatsuyuki/riscv-gnu-toolchain that referenced this issue Nov 28, 2023
Some glibc tests like tst-unwind-{main,ctor} depends on stage2 artifacts
(in particular, GCC runtime libs) to be properly installed. Add stage2
dependencies to avoid these tests from spuriously failing.

The test suite also uses the simulator and Deja GNU, both of which were
not declared as dependencies, so add them as well.

Closes: riscv-collab#1379
cmuellner pushed a commit that referenced this issue Nov 30, 2023
Some glibc tests like tst-unwind-{main,ctor} depends on stage2 artifacts
(in particular, GCC runtime libs) to be properly installed. Add stage2
dependencies to avoid these tests from spuriously failing.

The test suite also uses the simulator and Deja GNU, both of which were
not declared as dependencies, so add them as well.

Closes: #1379
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 a pull request may close this issue.

2 participants