<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/142927>142927</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
A error diagnostic for non-existent `PHDR` would be helpful
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
parth-07
</td>
</tr>
</table>
<pre>
LLD allows to refer to non-existent `PHDR` when no `PHDRS` command is specified. It should be an error to do so.
Reproducible example:
```bash
#!/usr/bin/env bash
cat >1.c <<\EOF
int foo() { return 1; }
int var = 3;
EOF
cat >script.t <<\EOF
SECTIONS {
.text : { *(.text.*) } :C
.data : { *(.data.*) }
}
EOF
clang -o 1.o 1.c -c -ffunction-sections -fdata-sections
ld.lld -o 1.out 1.o -T script.t # No error/warning for non-existent PHDR C
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxkU91u8ygQfZrxzcgWBv_EF75wklpbqWpXbV8AGxyzImABTrpvv8JJf7afhA3MnDkzozlw79XJSNlCuYfymPA1zNa1C3dhTkmdDFb82z49HZFrba8eg0UnJ-niwViTyg_lgzQBoSJ__3V8hYrgdZYGjf00vUXbaM9nbgQqj36Ro5qUFBk-BvSzXbXAQSI3KJ2zG7Ww6G0GpAPSvcrFWbGOatAS5Qc_L1oC625OqMhtDdzP8U4Z0Bxov3oHtB-UAdpLc8FPP-lGHhDYQ56NCOwQV3l4eOmBdMoEnKwFugPaINR7dDKszmAObI9QH28EEXbhDoEdkQHbA-lu8d_kfnRqCVn4neHt4fD--PL8FsmBdIhZkB8R1W3pgHZAd5st286ximN0H25owQP_jY62H-hYx_b_rklzc8LUYp7Fb8R0xHSaVjMGZU3q5bZ7TKdI9XUH0mmRaS3uoWvYCNJ3_OoOgTJ8tre5Ae2v3BllTjhZ9391RB3g4ee8EtEy0bCGJ7LN66LJc1ZUeTK3nJFBCEkqPlSUNkWz43lZVGwqWUF2hUhUSwktSUVKsitzkmd1QwpWCCol24m6qKEg8syVzrS-nDPrTonyfpVtXtCG1onmg9R-EzylRl5x8wKlUf-ujUHpsJ48FEQrH_w3TVBBy7a7y1QofjLWBzX-2e_P1_Cp71nqZVp1sjrdziEsPoqY9kD7kwrzOmSjPQPtY7b7li7O_iPHALTfavRA-3sTl5b-FwAA__8SChxM">