Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -627,7 +627,7 @@ // '.' is assigned to, but creating these section should not have any bad // consequeces and gives us a section to put the symbol in. uint64_t Flags = SHF_ALLOC; - uint32_t Type = SHT_NOBITS; + uint32_t Type = SHT_PROGBITS; for (BaseCommand *Base : Opt.Commands) { auto *Cmd = dyn_cast(Base); if (!Cmd) Index: test/ELF/linkerscript/orphan-first-cmd.s =================================================================== --- test/ELF/linkerscript/orphan-first-cmd.s +++ test/ELF/linkerscript/orphan-first-cmd.s @@ -4,7 +4,7 @@ # RUN: foo = 123; \ # RUN: . = 0x1000; \ # RUN: . = 0x2000; \ -# RUN: .bar : { . = . + 1; } \ +# RUN: .bar : { *(.bar) } \ # RUN: }" > %t.script # RUN: ld.lld -o %t -T %t.script %t.o -shared # RUN: llvm-readobj -s %t | FileCheck %s @@ -16,3 +16,5 @@ # CHECK-NEXT: SHF_EXECINSTR # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x1000 + +.section .bar, "aw" Index: test/ELF/linkerscript/symbol-only.s =================================================================== --- test/ELF/linkerscript/symbol-only.s +++ test/ELF/linkerscript/symbol-only.s @@ -12,7 +12,7 @@ # CHECK: Sections: # CHECK-NEXT: Idx Name Size Address # CHECK-NEXT: 0 00000000 0000000000000000 -# CHECK: abc 00000000 [[ADDR:[0-9a-f]*]] BSS +# CHECK: abc 00000000 [[ADDR:[0-9a-f]*]] DATA # CHECK-NEXT: bar 00000000 0000000000001000 DATA # CHECK: SYMBOL TABLE: