<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/154431>154431</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Regression: segfault in simple hello world when using glibc 2.32-2.35 on x86_64
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          rautyrauty
      </td>
    </tr>
</table>

<pre>
    Hello everyone I'm trying to push a new llvm (19 or 20) into an older branch of my linux distribution, but there's a problem with glibc 2.32 that I cannot solve.
I have two options: either fix llvm, or patch the glibc 2.32. I don't know how to do either.

### helloworld.c
```c
#include <stdio.h>

int main() {
    printf("hello world\n");
    return 0;
}
```

### Description
Simple hello world program crashes with segmentation fault when compiled with LLVM 19 and LLVM 20 on systems with glibc 2.32-2.35. 

### Steps to Reproduce
1. `clang-19 helloworld.c -o hello`
2. `./hello`

### Expected Behavior
"hello world" output

### Actual Behavior
Segmentation fault

### Environment
- OS: ALT Linux
- glibc: 2.32 (also reproduced on 2.34, 2.35)
- LLVM: 19.1.7, 20.1.8
- Architecture: x86_64

### Additional Notes
- Works fine with GCC 10.3.1
- Works fine with LLVM 17.0.6
- Works fine with LLVM 20.1.8 and updated glibc 2.35 to https://sourceware.org/git/?p=glibc.git;a=commit;h=3f63f9dfe1dbb11486914b3fec767041fa6c7c95, but I can't update glibc to 2.35, only patch 2.32.
- Works with glibc 2.38+

### test.sh (yes, there is a double typo clang-20):
```bash
#!/bin/bash -x
pushd "$HOME" || return 1
cat > helloworld.c <<EOF
#include <stdio.h>

int main() {
    printf("hello world\n");
    return 0;
}
EOF

rpm -q glibc

echo "=========== clang-19 ============="
clang-19 -v
clang-19 helloworld.c -o hello19
./hello19
clang-19 -c -o helloworld19.bc helloworld.c -emit-llvm
lli-19 helloworld19.bc

echo "=========== clang-20 ============="
clang-20 -v
clang-20 helloworld.c -o hello20
./hello20
clang-20 -c -o helloworld20.bc helloworld.c -emit-llvm
lli-20 helloworld20.bc

echo "=========== clang-20 ============="
gcc -v
gcc helloworld.c -o hellogcc
./hellogcc
```

### Logs:
With glibc 2.32:

[llvm-hello-world-glibc-2-32.log](https://github.com/user-attachments/files/21870510/llvm-hello-world-glibc-2-32.log)

With glibc 2.35 updated to https://sourceware.org/git/?p=glibc.git;a=commit;h=24962427071fa532c3c48c918e9d64d719cc8a6c:

[llvm-hello-world-glibc-2-35-0-5.log](https://github.com/user-attachments/files/21870530/llvm-hello-world-glibc-2-35-0-5.log)

With glibc 2.35 updated to https://sourceware.org/git/?p=glibc.git;a=commit;h=3f63f9dfe1dbb11486914b3fec767041fa6c7c95:

[llvm-hello-world-glibc-2-35-0-234.log](https://github.com/user-attachments/files/21870549/llvm-hello-world-glibc-2-35-0-234.log)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEV81u2zgXfRp6cyGBupQsaeGFY8dfA6RfgWYwXQ4oirY4lUQNSdnx2w9IOYntpE1RFB2AMMyf-3MOLw8pbq3a9VIuSHZDsvWMj67RZmH46I7hZ1bp-rj4INtWg9xLc9S9hDuCeQfOHFW_A6dhGG0DHHp5gLbdd0CwSErQBpASLEH1TgPvQbe1NFAZ3osG9Ba6I7SqHx-hVtYZVY1O6Z7gCqrRgWukkQRzCxwGo6tWdnBQroFdqyoBGDME13AHdyB432sHVrd7GRO6vIOG7yW4gwY9eJ-WsCVI5V3CVj2GJH0cbWDgTjQ-2JnfGO6g9pnkDr72-gCNPniYtT458UF8QzY1aDw_B23aOhZ-Yk6nJqZVqhftWEsgbGVdrXTcEHY7-VC9g46rnmDhqSL5DaFLAIDBqN5twzAG9xD8k2zVE0SCJWFPS410o-mBTiMkX5-ncJ3qWlphVKCF0OWD6oZWwlkAT_bO8A6E4baRdiLdyl0ne8e9GWz52Do4NLIHobtBtbKeVt3f__kRkhJ4X0__kYLuwR6tk5293r4IY5bFcJ3gg5OD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