Skip to content

Commit

Permalink
send .init of all zeros to COMDEF sections
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Dec 21, 2019
1 parent 403f336 commit a434c83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/dmd/toobj.d
Expand Up @@ -511,7 +511,13 @@ void toObjFile(Dsymbol ds, bool multiobj)
auto dtb = DtBuilder(0);
StructDeclaration_toDt(sd, dtb);
sd.sinit.Sdt = dtb.finish();
out_readonly(sd.sinit); // put in read-only segment
if (dtallzeros(sd.sinit.Sdt))
{
sd.sinit.Sclass = SCglobal;
dt2common(&sd.sinit.Sdt);
}
else
out_readonly(sd.sinit); // put in read-only segment
outdata(sd.sinit);

// Put out the members
Expand Down
6 changes: 3 additions & 3 deletions test/compilable/extra-files/test11237.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

if [[ $OS == linux || $OS == freebsd ]]; then
nm -S ${OUTPUT_BASE}_0.o | grep "00010000 B _D9test112376Buffer6__initZ"
fi
#if [[ $OS == linux || $OS == freebsd ]]; then
# nm -S ${OUTPUT_BASE}_0.o | grep "00010000 B _D9test112376Buffer6__initZ"
#fi

0 comments on commit a434c83

Please sign in to comment.