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

Basic support for TI Arm Clang toolchain #11421

Merged
merged 2 commits into from
May 15, 2024
Merged

Conversation

mon
Copy link
Contributor

@mon mon commented Feb 20, 2023

The linker identifies itself with a custom name on stderr when given the --version flag:

fatal error: invalid option:  --version
tiarmclang: error: tiarmlnk command failed with exit code 1 (use -v to see invocation)

And the error for invalid options is different:

fatal error: invalid option:  --allow-shlib-undefined

Note two spaces between the colon and the bad flag.

Compiler successfully identified afterwards as:

C compiler for the host machine: C:/ti/ti-cgt-armllvm_2.1.2.LTS\bin/tiarmclang.exe (clang 2.1.2 "TI Arm Clang Compiler 2.1.2.LTS")
C linker for the host machine: C:/ti/ti-cgt-armllvm_2.1.2.LTS\bin/tiarmclang.exe ld.lld unknown version

As noted in the changelog, b_lundef=false and b_asneeded=false are both needed due to being unsupported flags, not sure if this is fine as-is (Google indexes meson changelogs pretty well) or whether they should be automagically disabled inside the LLD linker class.

@mon mon requested a review from jpakkane as a code owner February 20, 2023 06:03
@codecov
Copy link

codecov bot commented Feb 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.79%. Comparing base (675b47b) to head (82e9dca).

❗ Current head 82e9dca differs from pull request most recent head fd626e3. Consider uploading reports for the commit fd626e3 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11421      +/-   ##
==========================================
- Coverage   70.43%   68.79%   -1.65%     
==========================================
  Files         219      207      -12     
  Lines       48781    45332    -3449     
  Branches    11606     9378    -2228     
==========================================
- Hits        34359    31185    -3174     
+ Misses      11980    11751     -229     
+ Partials     2442     2396      -46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mon
Copy link
Contributor Author

mon commented Apr 27, 2023

Bumping with a rebase against current master. Anything needed from me?

Copy link
Member

@eli-schwartz eli-schwartz left a comment

Choose a reason for hiding this comment

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

or whether they should be automagically disabled inside the LLD linker class.

Either that or via a custom subclass. ;)

Is this something that users will need to distinguish between TI arm clang vs regular clang using cc.get_linker_id()?

mesonbuild/linkers/linkers.py Show resolved Hide resolved
@mon
Copy link
Contributor Author

mon commented May 1, 2023

Either that or via a custom subclass. ;)

Is this something that users will need to distinguish between TI arm clang vs regular clang using cc.get_linker_id()?

Have you got any strong leanings toward a custom subclass for a cleaner implementation, or is this OK as is?

I think embedded compilation is specific enough that nobody will really be compiling a piece of code with two different embedded linkers. In the case of tests, I expect people would use meson.is_cross_build() to adjust build logic.

@eli-schwartz
Copy link
Member

Have you got any strong leanings toward a custom subclass for a cleaner implementation, or is this OK as is?

Not really. I just mentioned it for the sake of argument. I am not sure whether it matters or doesn't matter.

@mon
Copy link
Contributor Author

mon commented May 2, 2023

Bah, the more I think about it the more "you must specify these options" feels like a lazy hack fix, especially since I made it work "properly" for the TI CGT compiler. I'll add a TiLLVMDynamicLinker with ID ld.ti and do it right.

@mon
Copy link
Contributor Author

mon commented May 2, 2023

Although, as I think a little more - is there any worth to making LLVMDynamicLinker have a function such as supports_argument, which is then extended to gate --no-undefined and --as-needed in addition to --allow-shlib-undefined? I initially didn't consider it because I feel like it might secretly hide any silly bugs with flags (eg: misspelled), especially since those flags are usually pretty specific for those that use them.

@mon
Copy link
Contributor Author

mon commented Jul 5, 2023

Alright, I'm happy with this flag detection now - no modifications needed to any meson.build files, and supports any future compilers missing these standard flags. As discussed before, I'm fine with not having a special linker ID for TI Arm Clang, so this is ready to merge if you're happy with it!

@tristan957
Copy link
Contributor

@eli-schwartz what's the status on this PR? Seems like it might've just been forgotten.

@tristan957 tristan957 added this to the 1.3.0 milestone Oct 11, 2023
@xclaesse xclaesse modified the milestones: 1.3.0, 1.4.0 Oct 17, 2023
@mon
Copy link
Contributor Author

mon commented Mar 13, 2024

Rebased to latest master, seeing C6000 support got merged I hope this one can as well! (pending test runs)

When C6000 support was added in mesonbuild#12246, TI compilers were given the correct version argument.
This broke the previous check which relied on an error being thrown by the compiler.
@mon mon requested a review from dcbaker as a code owner April 3, 2024 03:48
@bruchar1 bruchar1 removed this from the 1.4.0 milestone Apr 3, 2024
@mon
Copy link
Contributor Author

mon commented May 15, 2024

Sorry for the bump, is there anything I can do to help move this along? If there are missing tests that might make it easier from your end, additional documentation etc.

@jpakkane jpakkane merged commit f24307e into mesonbuild:master May 15, 2024
36 checks passed
@jpakkane
Copy link
Member

Sorry for the delay.

@tristan957
Copy link
Contributor

Thanks for bumping it @mon

@mon
Copy link
Contributor Author

mon commented May 15, 2024

Thank you so much!

@eli-schwartz eli-schwartz added this to the 1.5.0 milestone May 16, 2024
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.

6 participants