Skip to content

[native] Fix build of strrchr#124372

Merged
ManickaP merged 1 commit intodotnet:mainfrom
ManickaP:clr-build
Feb 13, 2026
Merged

[native] Fix build of strrchr#124372
ManickaP merged 1 commit intodotnet:mainfrom
ManickaP:clr-build

Conversation

@ManickaP
Copy link
Copy Markdown
Member

After the recent update of glic from 2.42 -> 2.43, strrchr returns const char* if the arg is const char*, see https://sourceware.org/pipermail/libc-alpha/2026-January/174374.html:

  • For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
    strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
    pointers into their input arrays now have definitions as macros that
    return a pointer to a const-qualified type when the input argument is
    a pointer to a const-qualified type.

The standard build.sh clr+libs -rc release was failing for me on line 933:

p = strrchr (file, '/');

so I change the type of p to const char*.

I'm not sure this is the right way to fix this, so please let me know how else could I do it. But without any change, I'm not able to build the runtime.

cc @janvorli

Copilot AI review requested due to automatic review settings February 13, 2026 10:27
@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 13, 2026
@ManickaP ManickaP removed the request for review from janvorli February 13, 2026 10:28
@ManickaP ManickaP added area-PAL-coreclr only for closed issues and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Feb 13, 2026
@ManickaP ManickaP requested a review from janvorli February 13, 2026 10:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a build break in the vendored libunwind elfxx.c after glibc 2.43’s C23-related changes that make strrchr return const char* when passed a const char*.

Changes:

  • Update the local variable receiving strrchr(file, '/') from char* to const char*.
  • Remove a couple of trailing whitespace instances in designated initializers.

@ManickaP ManickaP requested a review from am11 February 13, 2026 10:29
@am11
Copy link
Copy Markdown
Member

am11 commented Feb 13, 2026

Please upstream it to https://github.com/libunwind/libunwind and update src/native/external/libunwind-version.txt with reference to upstream PR.

@am11
Copy link
Copy Markdown
Member

am11 commented Feb 13, 2026

It has already been merged upstream: libunwind/libunwind#940. You can simply add:

Apply https://github.com/libunwind/libunwind/pull/940

right after this line:

Apply https://github.com/libunwind/libunwind/pull/931

This helps with patch accounting in the next major update.

Comment thread src/native/external/libunwind/src/elfxx.c Outdated
Copy link
Copy Markdown
Member

@am11 am11 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Copy Markdown
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@ManickaP ManickaP merged commit 9e2708d into dotnet:main Feb 13, 2026
154 of 156 checks passed
@ManickaP ManickaP deleted the clr-build branch February 13, 2026 15:15
richlander pushed a commit to richlander/runtime that referenced this pull request Feb 14, 2026
After the recent update of glic from 2.42 -> 2.43, `strrchr` returns
`const char*` if the arg is `const char*`, see
https://sourceware.org/pipermail/libc-alpha/2026-January/174374.html:
> * For ISO C23, the functions bsearch, memchr, strchr, strpbrk,
strrchr,
  strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
  pointers into their input arrays now have definitions as macros that
  return a pointer to a const-qualified type when the input argument is
  a pointer to a const-qualified type.
  
The standard `build.sh clr+libs -rc release` was failing for me on line
933:
```c
p = strrchr (file, '/');
```
so I change the type of `p` to `const char*`.

I'm not sure this is the right way to fix this, so please let me know
how else could I do it. But without any change, I'm not able to build
the runtime.

cc @janvorli
iremyux pushed a commit to iremyux/dotnet-runtime that referenced this pull request Mar 2, 2026
After the recent update of glic from 2.42 -> 2.43, `strrchr` returns
`const char*` if the arg is `const char*`, see
https://sourceware.org/pipermail/libc-alpha/2026-January/174374.html:
> * For ISO C23, the functions bsearch, memchr, strchr, strpbrk,
strrchr,
  strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
  pointers into their input arrays now have definitions as macros that
  return a pointer to a const-qualified type when the input argument is
  a pointer to a const-qualified type.
  
The standard `build.sh clr+libs -rc release` was failing for me on line
933:
```c
p = strrchr (file, '/');
```
so I change the type of `p` to `const char*`.

I'm not sure this is the right way to fix this, so please let me know
how else could I do it. But without any change, I'm not able to build
the runtime.

cc @janvorli
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-PAL-coreclr only for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants