Skip to content

Commit

Permalink
change mutable __gshared to immutable in elfobj.d (#16658)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored Jul 4, 2024
1 parent 750a747 commit 18c8d78
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/src/dmd/backend/elfobj.d
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ void ElfObj_term(const(char)[] objfilename)
elfobj.fobjbuf.position(0, hdrsize);
if (I64)
{
__gshared Elf64_Ehdr h64 =
__gshared immutable Elf64_Ehdr h64_init =
{
[
ELFMAG0,ELFMAG1,ELFMAG2,ELFMAG3,
Expand All @@ -1305,14 +1305,15 @@ void ElfObj_term(const(char)[] objfilename)
0, // e_shnum
SHN_SECNAMES // e_shstrndx
};
Elf64_Ehdr h64 = h64_init;
h64.EHident[EI_OSABI] = ELFOSABI;
h64.e_shoff = e_shoff;
h64.e_shnum = e_shnum;
elfobj.fobjbuf.write(&h64, hdrsize);
}
else
{
__gshared Elf32_Ehdr h32 =
__gshared immutable Elf32_Ehdr h32_init =
{
[
ELFMAG0,ELFMAG1,ELFMAG2,ELFMAG3,
Expand All @@ -1336,6 +1337,7 @@ void ElfObj_term(const(char)[] objfilename)
0, // e_shnum
SHN_SECNAMES // e_shstrndx
};
Elf32_Ehdr h32 = h32_init;
h32.EHident[EI_OSABI] = ELFOSABI;
h32.e_shoff = cast(uint)e_shoff;
h32.e_shnum = e_shnum;
Expand Down

0 comments on commit 18c8d78

Please sign in to comment.