Thread overview
"--oformat" is not supported [windows]
Dec 27, 2020
sdvcn
Dec 29, 2020
kinke
Dec 29, 2020
sdvcn
Dec 30, 2020
kinke
Dec 30, 2020
sdvcn
Dec 30, 2020
David Nadlinger
Dec 31, 2020
sdvcn
December 27, 2020
binary    D:\D\ldc2\bin\ldc2.exe
version   1.24.0 (DMD v2.094.1, LLVM 11.0.0)
predefs   LDC all D_Version2 assert D_ModuleInfo D_Exceptions D_TypeInfo ARM Thumb ARM_Thumb ARM_SoftFP D_HardFloat LittleEndian LDC_LLVM_1100
parse     m2
importall m2
import    object        (object.d)
semantic  m2
semantic2 m2
semantic3 m2
GC stats  0M used, 1M free, 1M total
code      m2
lld m2.o -o m2 --oformat=elf
lld: error: unknown argument '--oformat=elf', did you mean '--format=elf'
Error: linking with LLD failed

"--oformat" is not supported
December 29, 2020
On Sunday, 27 December 2020 at 14:55:59 UTC, sdvcn wrote:
> lld m2.o -o m2 --oformat=elf
> lld: error: unknown argument '--oformat=elf', did you mean '--format=elf'
> Error: linking with LLD failed

AFAIK, that linker option isn't implicitly added by LDC.
December 29, 2020
On Tuesday, 29 December 2020 at 09:24:49 UTC, kinke wrote:
> On Sunday, 27 December 2020 at 14:55:59 UTC, sdvcn wrote:
>> lld m2.o -o m2 --oformat=elf
>> lld: error: unknown argument '--oformat=elf', did you mean '--format=elf'
>> Error: linking with LLD failed
>
> AFAIK, that linker option isn't implicitly added by LDC.

Windows version of clang

ld.lld --oformat binary --version
LLD 11.0.0 (compatible with GNU linkers)


clang can be executed normally

"clang -target armv7em-none-eabi  -Xlinker --oformat -Xlinker binary --static  -nostdinc++  -fuse-ld=lld -fdeclspec -Bstatic -nogpulib -xc  -o o1.bin test.c -v -L/usr/arm-none-eabi/lib/ -femulated-tls"


ldc2 mm.d --mtriple=arm-none-eabi --link-internally -L"--version" -L="--oformat binary" -v
binary    D:\D\ldc2\bin\ldc2.exe
version   1.24.0 (DMD v2.094.1, LLVM 11.0.0)
config    D:\D\ldc2\etc\ldc2.conf (arm-none-unknown-eabi)
predefs   LDC all D_Version2 assert D_BetterC ARM ARM_SoftFP D_HardFloat LittleEndian LDC_LLVM_1100
lld mm.o -static -o mm -nostdlib --version --oformat binary
lld: error: unknown argument '--oformat binary'
LLD 11.0.0 (https://github.com/ldc-developers/llvm-project 7d41290105aa8d0485099de9d5dc850f02b60859) (compatible with GNU linkers)
Error: linking with LLD failed




December 30, 2020
With -link-internally, LDC uses the builtin LLD; we don't recommend it on the cross-compile Wiki for non-Windows targets (and a C compiler like clang instead). LLD comes with different driver flavors (usually determined by the LLD executable filename, e.g., lld-link.exe and ld.lld.exe) with differing CLI; plain lld as used for non-Windows targets with -link-internally apparently expects `--format=elf` instead of `--oformat`. So either use something like `-link-internally -L--format=binary` or `-gcc=clang -Xcc=-target -Xcc=armv7em-none-eabi -linker=lld -L--oformat -Lbinary`.
December 30, 2020
On Wednesday, 30 December 2020 at 14:15:11 UTC, kinke wrote:
> With -link-internally, LDC uses the builtin LLD; we don't recommend it on the cross-compile Wiki for non-Windows targets (and a C compiler like clang instead). LLD comes with different driver flavors (usually determined by the LLD executable filename, e.g., lld-link.exe and ld.lld.exe) with differing CLI; plain lld as used for non-Windows targets with -link-internally apparently expects `--format=elf` instead of `--oformat`. So either use something like `-link-internally -L--format=binary` or `-gcc=clang -Xcc=-target -Xcc=armv7em-none-eabi -linker=lld -L--oformat -Lbinary`.

I think I should describe the error,
What I want to describe is that the parameter "oformat" cannot be passed

我想应该是我描述错误,
我想描述的是"oformat"这个参数无法传递
December 30, 2020
On 30 Dec 2020, at 17:08, sdvcn--- via digitalmars-d-ldc wrote:
> I think I should describe the error,
> What I want to describe is that the parameter "oformat" cannot be passed

Yes, sure. But you are specifying that parameter, and it simply doesn't exist for that flavour of LLD. It would be different if LDC itself added a parameter that then couldn't be found. In that case, it would be a bug in LDC. In your case, however, it isn't.

 — David
December 31, 2020
On Wednesday, 30 December 2020 at 16:53:07 UTC, David Nadlinger wrote:
> On 30 Dec 2020, at 17:08, sdvcn--- via digitalmars-d-ldc wrote:
>> I think I should describe the error,
>> What I want to describe is that the parameter "oformat" cannot be passed
>
> Yes, sure. But you are specifying that parameter, and it simply doesn't exist for that flavour of LLD. It would be different if LDC itself added a parameter that then couldn't be found. In that case, it would be a bug in LDC. In your case, however, it isn't.
>
>  — David


After re-reading the code, I confirmed that the way I passed the parameters was incorrect, thanks to David and Kinke for the explanation

重读代码后确认了我传递参数方式不正确,感谢David和kinke的说明

Thanks for the answer

ld.lld:
ld.lld --oformat=binary"

ldc2:
ldc2 --link-internally -L=--oformat -L=binary