diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-06 19:26:12 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-06 19:26:12 +0000 |
commit | 013321a0f9e9f784ebb9a78ebf19e5f5099d5b16 (patch) | |
tree | 753bc6d742f12a5bb5f04d59afe902c14caba635 /docs/Extensions.rst | |
parent | 5448320a2061faeadedc800dff9a9adf14005a72 (diff) | |
download | llvm-013321a0f9e9f784ebb9a78ebf19e5f5099d5b16.tar.gz llvm-013321a0f9e9f784ebb9a78ebf19e5f5099d5b16.tar.bz2 llvm-013321a0f9e9f784ebb9a78ebf19e5f5099d5b16.tar.xz |
Fix a few issues with comdat handling on COFF.
* Section association cannot use just the section name as many
sections can have the same name. With this patch, the comdat symbol in
an assoc section is interpreted to mean a symbol in the associated
section and the mapping is discovered from it.
* Comdat symbols were not being set correctly. Instead we were getting
whatever was output first for that section.
A consequence is that associative sections now must use .section to
set the association. Using .linkonce would not work since it is not
possible to change a sections comdat symbol (it is used to decide if
we should create a new section or reuse an existing one).
This includes r210298, which was reverted because it was asserting
on an associated section having the same comdat as the associated
section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210367 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/Extensions.rst')
-rw-r--r-- | docs/Extensions.rst | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/docs/Extensions.rst b/docs/Extensions.rst index a49485cc5e..cd489c0e54 100644 --- a/docs/Extensions.rst +++ b/docs/Extensions.rst @@ -76,7 +76,7 @@ the target. It corresponds to the COFF relocation types Syntax: - ``.linkonce [ comdat type [ section identifier ] ]`` + ``.linkonce [ comdat type ]`` Supported COMDAT types: @@ -95,16 +95,6 @@ Supported COMDAT types: Duplicates are discarded, but the linker issues an error if any duplicates do not have exactly the same content. -``associative`` - Links the section if a certain other COMDAT section is linked. This other - section is indicated by its section identifier following the comdat type. - The following restrictions apply to the associated section: - - 1. It must be the name of a section already defined. - 2. It must differ from the current section. - 3. It must be a COMDAT section. - 4. It cannot be another associative COMDAT section. - ``largest`` Links the largest section from among the duplicates. @@ -118,10 +108,6 @@ Supported COMDAT types: .linkonce ... - .section .xdata$foo - .linkonce associative .text$foo - ... - ``.section`` Directive ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -160,6 +146,25 @@ different COMDATs: Symbol2: .long 1 +In addition to the types allowed with ``.linkonce``, ``.section`` also accepts +``associative``. The meaning is that the section is linked if a certain other +COMDAT section is linked. This other section is indicated by the comdat symbol +in this directive. It can be any symbol defined in the associated section, but +is usually the associated section's comdat. + + The following restrictions apply to the associated section: + + 1. It must be a COMDAT section. + 2. It cannot be another associative COMDAT section. + +In the following example the symobl ``sym`` is the comdat symbol of ``.foo`` +and ``.bar`` is associated to ``.foo``. + +.. code-block:: gas + + .section .foo,"bw",discard, "sym" + .section .bar,"rd",associative, "sym" + Target Specific Behaviour ========================= |