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

Test case tls-gd-mcmodel-large passes invalid compile-flag combination to gcc on aarch64 #384

Closed
sicherha opened this issue Mar 8, 2022 · 1 comment

Comments

@sicherha
Copy link
Contributor

sicherha commented Mar 8, 2022

When building mold 1.1.1 for Fedora on aarch64, the tls-gd-mcmodel-large test case fails because GCC does not support the combination of -mcmodel=large with -fPIC. This is documented here: https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html

Output of instrumented test case:

++ basename ./elf/tls-gd-mcmodel-large.sh .sh
+ testname=tls-gd-mcmodel-large
Testing tls-gd-mcmodel-large ... + echo -n 'Testing tls-gd-mcmodel-large ... '
++ dirname ./elf/tls-gd-mcmodel-large.sh
+ cd ./elf/../..
++ pwd
+ mold=/builddir/build/BUILD/mold-1.1.1/mold
+ t=out/test/elf/tls-gd-mcmodel-large
+ mkdir -p out/test/elf/tls-gd-mcmodel-large
++ uname -m
+ '[' aarch64 = x86_64 ']'
++ uname -m
+ '[' aarch64 = aarch64 ']'
+ dialect=trad
+ cat
+ gcc -mtls-dialect=trad -fPIC -c -o out/test/elf/tls-gd-mcmodel-large/a.o -xc - -mcmodel=large
cc1: sorry, unimplemented: code model 'large' with '-fPIC'

I tried replacing gcc with clang as a quick fix, but Clang doesn't know the -mtls-dialect=gnu option.

Curiously, the test case contains an explicit if-branch for setting the correct TLS dialect on aarch64. Does this mean that it worked at some point in the past? The sentence

The -mcmodel=large option is incompatible with -mabi=ilp32, -fpic and -fPIC.

was added in the documentation for GCC 10; it was not yet present in the GCC 9 documentation.

@sicherha
Copy link
Contributor Author

sicherha commented Mar 8, 2022

Same thing for tls-ld-mcmodel-large.

Related pull request: #286

@rui314 rui314 closed this as completed in 41cf6d7 Mar 9, 2022
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

1 participant