[MachO] Stop generating *coal* sections.
authorAkira Hatanaka <ahatanaka@apple.com>
Wed, 14 Oct 2015 22:45:36 +0000 (22:45 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Wed, 14 Oct 2015 22:45:36 +0000 (22:45 +0000)
commit07c629ffc074853c4fb3c01ae3c81b84199be070
tree43eeea6ef5727e7f2a1d9a406479ff00735f5c2e
parentc52d6d530c80207b6cc33633b901d3e332ab34b6
[MachO] Stop generating *coal* sections.

Some background on why we don't have to use *coal* sections anymore:
Long ago when C++ was new and "weak" had not been standardized, an attempt was
made in cctools to support C++ inlines that can be coalesced by putting them
into their own section (TEXT/textcoal_nt instead of TEXT/text).

The current macho linker supports the weak-def bit on any symbol to allow it to
be coalesced, but the compiler still puts weak-def functions/data into alternate
section names, which the linker must map back to the base section name.

This patch makes changes that are necessary to prevent the compiler from using
the "coal" sections and have it use the non-coal sections instead when the
target architecture is not powerpc:

TEXT/textcoal_nt instead use TEXT/text
TEXT/const_coal instead use TEXT/const
DATA/datacoal_nt instead use DATA/data

If the target is powerpc, we continue to use the *coal* sections since anyone
targeting powerpc is probably using an old linker that doesn't have support for
the weak-def bits.

Also, have the assembler issue a warning if it encounters a *coal* section in
the assembly file and inform the users to use the non-coal sections instead.

rdar://problem/14265330

Differential Revision: http://reviews.llvm.org/D13188

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250342 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/MCObjectFileInfo.cpp
lib/MC/MCParser/DarwinAsmParser.cpp
test/CodeGen/PowerPC/coal-sections.ll [new file with mode: 0644]
test/CodeGen/X86/coal-sections.ll [new file with mode: 0644]
test/CodeGen/X86/global-sections.ll
test/MC/MachO/coal-sections-powerpc.s [new file with mode: 0644]
test/MC/MachO/coal-sections-x86_64.s [new file with mode: 0644]