<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87891>87891</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Linker script `OUTPUT_FORMAT` command does not support `binary` option
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fumoboy007
</td>
</tr>
</table>
<pre>
# Background
The `OUTPUT_FORMAT` linker script [command](https://sourceware.org/binutils/docs/ld/Format-Commands.html) is equivalent to the `--oformat` command-line option.
[D23769](https://reviews.llvm.org/D23769) implemented support for `--oformat binary`, which is used for embedded devices that do not support standard executable container formats like ELF.
# Problem
It appears that D23769 only updated the command-line driver and did not update the linker script [parser implementation](https://github.com/llvm/llvm-project/blob/b88a1dd6c75754ace4abe18c8ea16a019f7b5529/lld/ELF/ScriptParser.cpp#L457-L487). So the linker script command `OUTPUT_FORMAT(binary)` is currently unrecognized.
# Proposed Solution
As far as I can tell, the change to the parser implementation should be trivial: check for the special value `"binary"` and set `config->oFormatBinary = true`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEtv4zYQ_jXUZWCDot4HHex1DCzgYoMmey4ocmyxoUiVD6fpry8oO9kY8WUvJmANOd9rhnuvTgaxJ9WWVLuMxzBa1x_jZAf7RmmTDVa-9YQVsOXi5eRsNJLQHaGby-_ziEBq-uPn8-PP57_2P_78Y_NMagpamRd04IVTcwBSbYWdJm4kqXaEtWMIsyfFhrA9YXtvoxP4yh2urTsRth-UiUFpT9heWpEOLQnb762beFh9u7zk12OYNGEdKA_4T1RnrtEECBbCBdRqZY_LlQTo2n-llUGwc1DWrD8TIdV2x4qm7u4hdHhW-OrXWp-nK8ZrcWo_zRonNAEl-DjP1gU4WneDAAZluHsjNSXsG7yOSowJdvQol1qcBpQSJUg8K4EewsgDSAvGho9HfeBGcicB_0URAx80grAmcGXQwaWRB61eEB4O-1t2rIBHZweN0-e_vwfg84zcXRteSIE1-g3iLHmilMS8EU86dUYH3EiQSi4IL7VL6RfjZ-48ul8q8ST9PZFPKoxxWAs7JcP1-f1Yzc7-jSKkYGg7pKNteS5lLZqqqUousOQD5q1okec1p3l3bIaqYt3yQErOwyE1eFowPS541mKeCSsOZdWsDmXbENat4cneoXDl_jXlrL2ayroUMOVBROfQhCSecSjsyaj_UN4zYrbJ-Ser46LGp4KNhyN3wD18B8ENBNQ6ZWaxYeTmhO8Jvyss-NFGLWFACE6dFdek2IAYUbwsQUsX_YxCcQ1nruMyKISxdyosUUl0PYb0SVhzVKcVKR7sZfy2SyGQYgfBRSQ1XWeyL2RXdDzDPm9yVha0LGk29pXEPO-SN3XeNFXd5F1TDvmRFYwNx7bJVM8oK2lJ67yjDaNrbEXeVM2RDcXAB9qSkuLElf6YvEx5H7Fvm7bLM80H1H7ZXYwZfIXlYyJR7TLXL-EZ4smTkmrlw6_5zYIKGvvDbVbvrLF386VFfzOLpKYfI31dJ1l0uv_tSC-Q04pbKP0fAAD__2gtzXA">