Bug 282322 - graphics/mesa-devel: Disable "-mtls-dialect=gnu2" when built with clang 19
Summary: graphics/mesa-devel: Disable "-mtls-dialect=gnu2" when built with clang 19
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL: https://gitlab.freedesktop.org/mesa/m...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-25 20:18 UTC by Jung-uk Kim
Modified: 2024-11-01 18:22 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (jbeich)


Attachments
Add initial-exec TLS for FreeBSD (1.45 KB, patch)
2024-10-25 20:18 UTC, Jung-uk Kim
no flags Details | Diff
Detect and use TLS model for FreeBSD (1.60 KB, patch)
2024-10-29 23:26 UTC, Jung-uk Kim
jbeich: maintainer-approval-
Details | Diff
Disable "-mtls-dialect=gnu2" when built with clang 19 (1.25 KB, patch)
2024-11-01 06:58 UTC, Jung-uk Kim
jbeich: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jung-uk Kim freebsd_committer freebsd_triage 2024-10-25 20:18:53 UTC
Created attachment 254513 [details]
Add initial-exec TLS for FreeBSD

When it is compiled with Clang 19, it fails to run with errors like this:

Unsupported relocation type 36 in non-PLT relocations

That's because Clang 19 now supports "-mtls-dialect=gnu2" but our rtld does not support it.  In fact, we have been using "-ftls-model=initial-exec" instead.
Comment 1 Jung-uk Kim freebsd_committer freebsd_triage 2024-10-29 23:26:05 UTC
Created attachment 254626 [details]
Detect and use TLS model for FreeBSD

Updated to use the upstream merge request.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2024-10-30 11:01:13 UTC
Comment on attachment 254626 [details]
Detect and use TLS model for FreeBSD

> -TIMESTAMP = 1729714788
> +TIMESTAMP = 1730244192

Better drop this hunk to avoid conflicts when cherry-picking e.g., during "git bisect" in ports/ or with old /quarterly branches.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2024-10-30 17:55:50 UTC
Comment on attachment 254626 [details]
Detect and use TLS model for FreeBSD

After more testing I'd prefer implicit -ftls-model=global-dynamic to avoid regressions. For one, Rusticl is important due to bug 281566.
Comment 4 Jung-uk Kim freebsd_committer freebsd_triage 2024-11-01 06:58:09 UTC
Created attachment 254839 [details]
Disable "-mtls-dialect=gnu2" when built with clang 19

I disabled support for TLS model because I failed to fix regressions reported by jbeich@.
Comment 5 Jung-uk Kim freebsd_committer freebsd_triage 2024-11-01 07:12:26 UTC
(In reply to Jan Beich from comment #3)
I don't see any reason to implicitly set '-ftls-model=global-dynamic' as it is default.
Comment 6 Jan Beich freebsd_committer freebsd_triage 2024-11-01 09:44:21 UTC
Comment on attachment 254839 [details]
Disable "-mtls-dialect=gnu2" when built with clang 19

Thanks. Works fine and matches Clang < 19 behavior.
Comment 7 commit-hook freebsd_committer freebsd_triage 2024-11-01 18:18:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9deb1db0634686b589ce81278e03206fe340f4bc

commit 9deb1db0634686b589ce81278e03206fe340f4bc
Author:     Jung-uk Kim <jkim@FreeBSD.org>
AuthorDate: 2024-11-01 18:12:46 +0000
Commit:     Jung-uk Kim <jkim@FreeBSD.org>
CommitDate: 2024-11-01 18:12:46 +0000

    graphics/mesa-devel: Disable "-mtls-dialect=gnu2" when built with clang 19

    Clang 19 now supports "-mtls-dialect=gnu2" but it does not work for us.
    Originally, I tried to use "-ftls-model=initial-exec" but it caused
    regressions.  Disable the optimization for now until we have a proper
    implementation.

    Approved by:    jbeich (maintainer)
    PR:             282322

 graphics/mesa-devel/Makefile | 1 +
 graphics/mesa-devel/distinfo | 2 ++
 2 files changed, 3 insertions(+)