// Note that AMDGPU binaries have no entries.
if (!Config->Entry.empty()) {
// It is either "-e <addr>" or "-e <symbol>".
- if (Config->Entry.getAsInteger(0, Config->EntryAddr))
- Config->EntrySym = Symtab.addUndefined(Config->Entry);
+ Config->Entry.getAsInteger(0, Config->EntryAddr);
} else if (!Config->Shared && !Config->Relocatable &&
Config->EMachine != EM_AMDGPU) {
// -e was not specified. Use the default start symbol name
// if it is resolvable.
Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";
- if (Symtab.find(Config->Entry))
- Config->EntrySym = Symtab.addUndefined(Config->Entry);
}
+ if (Symtab.find(Config->Entry))
+ Config->EntrySym = Symtab.addUndefined(Config->Entry);
if (HasError)
return; // There were duplicate symbols or incompatible files
# RUN: ld.lld -o %t2 %t.script %t
# RUN: llvm-readobj %t2 > /dev/null
+# The entry symbol should not cause an undefined error.
# RUN: echo "ENTRY(_wrong_label)" > %t.script
-# RUN: not ld.lld -o %t2 %t.script %t > %t.log 2>&1
-# RUN: FileCheck -check-prefix=ERR-ENTRY %s < %t.log
-
-# ERR-ENTRY: undefined symbol: _wrong_label
+# RUN: ld.lld -o %t2 %t.script %t
+# RUN: ld.lld --entry=abc -o %t2 %t
# -e has precedence over linker script's ENTRY.
# RUN: echo "ENTRY(_label)" > %t.script