[MachO] Stop generating *coal* sections.
authorAkira Hatanaka <ahatanaka@apple.com>
Thu, 15 Oct 2015 05:28:38 +0000 (05:28 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Thu, 15 Oct 2015 05:28:38 +0000 (05:28 +0000)
commitc770c8d638a69cd3cd527c54f08008f45bbab2c5
tree9abe6985234e5137c7a93e98dfccdba69c253787
parent1c2a5723868f97a118dc69e29a30e06765e35a6c
[MachO] Stop generating *coal* sections.

Recommit r250342: move coal-sections-powerpc.s to subdirectory for powerpc.

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@250370 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/PowerPC/coal-sections-powerpc.s [new file with mode: 0644]
test/MC/MachO/PowerPC/lit.local.cfg [new file with mode: 0644]
test/MC/MachO/coal-sections-x86_64.s [new file with mode: 0644]