[MachO] Stop generating *coal* sections.
authorAkira Hatanaka <ahatanaka@apple.com>
Wed, 14 Oct 2015 23:48:10 +0000 (23:48 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Wed, 14 Oct 2015 23:48:10 +0000 (23:48 +0000)
commit82dd03ed9db110527130c027c570e03a7d238836
tree8fbba045782184886b27fa48c80de18d10e8a0eb
parent9b99309532626fa4177519d64adf6b433826ec63
[MachO] Stop generating *coal* sections.

Recommit r250342: add -arch=ppc32 to the RUN lines of powerpc tests.

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@250349 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]