From 56c255e563c55158eeb49757daefab9857220b7c Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 25 Jul 2021 12:53:14 -0700 Subject: [PATCH] [LangRef] Reorder two paragraphs for comdat so that IMAGE_COMDAT_SELECT_LARGEST refers to the correct example. --- docs/LangRef.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/LangRef.rst b/docs/LangRef.rst index beeffeb2e81..9784f0c9067 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -965,6 +965,12 @@ the COMDAT key's section is the largest: ret void } +In a COFF object file, this will create a COMDAT section with selection kind +``IMAGE_COMDAT_SELECT_LARGEST`` containing the contents of the ``@foo`` symbol +and another COMDAT section with selection kind +``IMAGE_COMDAT_SELECT_ASSOCIATIVE`` which is associated with the first COMDAT +section and contains the contents of the ``@bar`` symbol. + As a syntactic sugar the ``$name`` can be omitted if the name is the same as the global name: @@ -974,12 +980,6 @@ the global name: @foo = global i32 2, comdat @bar = global i32 3, comdat($foo) -In a COFF object file, this will create a COMDAT section with selection kind -``IMAGE_COMDAT_SELECT_LARGEST`` containing the contents of the ``@foo`` symbol -and another COMDAT section with selection kind -``IMAGE_COMDAT_SELECT_ASSOCIATIVE`` which is associated with the first COMDAT -section and contains the contents of the ``@bar`` symbol. - There are some restrictions on the properties of the global object. It, or an alias to it, must have the same name as the COMDAT group when targeting COFF.