llvm-project/clang/test
bd1976llvm 86478d3de9 [MC][ELF] Put explicit section name symbols into entry size compatible sections
Ensure that symbols explicitly* assigned a section name are placed into
a section with a compatible entry size.

This is done by creating multiple sections with the same name** if
incompatible symbols are explicitly given the name of an incompatible
section, whilst:

  - Avoiding using uniqued sections where possible (for readability and
    to maximize compatibly with assemblers).

  - Creating as few SHF_MERGE sections as possible (for efficiency).

Given that each symbol is assigned to a section in a single pass, we
must decide which section each symbol is assigned to without seeing the
properties of all symbols. A stable and easy to understand assignment is
desirable. The following rules facilitate this: The "generic" section
for a given section name will be mergeable if the name is a mergeable
"default" section name (such as .debug_str), a mergeable "implicit"
section name (such as .rodata.str2.2), or MC has already created a
mergeable "generic" section for the given section name (e.g. in response
to a section directive in inline assembly). Otherwise, the "generic"
section for a given name is non-mergeable; and, non-mergeable symbols
are assigned to the "generic" section, while mergeable symbols are
assigned to uniqued sections.

Terminology:
"default" sections are those always created by MC initially, e.g. .text
or .debug_str.

"implicit" sections are those created normally by MC in response to the
symbols that it encounters, i.e. in the absence of an explicit section
name assignment on the symbol, e.g. a function foo might be placed into
a .text.foo section.

"generic" sections are those that are referred to when a unique section
ID is not supplied, e.g. if there are multiple unique .bob sections then
".quad .bob" will reference the generic .bob section. Typically, the
generic section is just the first section of a given name to be created.
Default sections are always generic.

* Typically, section names might be explicitly assigned in source code
using a language extension e.g. a section attribute: _attribute_
((section ("section-name"))) -
https://clang.llvm.org/docs/AttributeReference.html

** I refer to such sections as unique/uniqued sections. In assembly the
", unique," assembly syntax is used to express such sections.

Fixes https://bugs.llvm.org/show_bug.cgi?id=43457.

See https://reviews.llvm.org/D68101 for previous discussions leading to
this patch.

Some minor fixes were required to LLVM's tests, for tests had been using
the old behavior - which allowed for explicitly assigning globals with
incompatible entry sizes to a section.

This fix relies on the ",unique ," assembly feature. This feature is not
available until bintuils version 2.35
(https://sourceware.org/bugzilla/show_bug.cgi?id=25380). If the
integrated assembler is not being used then we avoid using this feature
for compatibility and instead try to place mergeable symbols into
non-mergeable sections or issue an error otherwise.

Differential Revision: https://reviews.llvm.org/D72194
2020-04-16 19:12:49 +00:00
..
ARCMT
AST [AST] Fix recovery-expr crash on invalid aligned attr. 2020-04-15 16:15:20 +02:00
ASTMerge
Analysis [Analyzer][StreamChecker] Added evaluation of fseek. 2020-04-14 12:35:28 +02:00
CXX Disallow [[nodiscard]] on a function pointer declaration. 2020-04-16 09:28:49 -04:00
ClangScanDeps [clang][clang-scan-deps] Aggregate the full dependency information. 2020-01-23 16:58:50 -08:00
CodeCompletion [AST] Dont invalide VarDecl even the default initializaiton is failed. 2020-04-14 12:58:48 +02:00
CodeGen [MC][ELF] Put explicit section name symbols into entry size compatible sections 2020-04-16 19:12:49 +00:00
CodeGenCUDA Speed up deferred diagnostic emitter 2020-04-06 13:07:43 -04:00
CodeGenCXX Rework how UuidAttr, CXXUuidofExpr, and GUID template arguments and constants are represented. 2020-04-15 12:20:42 -07:00
CodeGenCoroutines [CodeGen] Add an alignment attribute to all sret parameters 2020-03-24 15:31:57 -04:00
CodeGenHIP
CodeGenObjC Emit Objective-C constructors as writable 2020-04-14 22:32:34 +02:00
CodeGenObjCXX [CodeGen] Add an alignment attribute to all sret parameters 2020-03-24 15:31:57 -04:00
CodeGenOpenCL AMDGPU: Teach toolchain to link rocm device libs 2020-04-10 13:37:32 -04:00
CodeGenOpenCLCXX [CodeGen] Add an alignment attribute to all sret parameters 2020-03-24 15:31:57 -04:00
CodeGenSYCL [SYCL] Implement __builtin_unique_stable_name. 2020-03-25 07:01:50 -07:00
Coverage
CoverageMapping Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
Driver clang/AMDGPU: Assume denormals are enabled for the default target. 2020-04-15 09:17:26 -04:00
FixIt [objc_direct] Small updates to help with adoption. 2020-02-16 16:32:41 -08:00
Format
Frontend [Fixed Point] Add triples to test cases. 2020-04-08 16:31:36 +02:00
Headers [OpenMP] Allow <math.h> to go first in C++-mode in target regions 2020-04-09 22:10:31 -05:00
Import [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
Index Expose AtomicType in the libclang C API. 2020-04-16 08:06:58 -04:00
Integration
InterfaceStubs [llvm][clang][IFS] Enhancing the llvm-ifs yaml format for symbol lists. 2020-04-01 10:49:06 -04:00
Layout [MS] Fix packed struct layout for arrays of aligned non-record types 2020-04-14 18:34:52 -07:00
Lexer Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang 2020-02-18 16:16:37 -08:00
Misc [hip] Remove `hip_pinned_shadow`. 2020-04-07 09:51:49 -04:00
Modules Slightly modify some tests as follow up to bcf66084, which breaks tests. 2020-04-07 09:25:16 -07:00
OpenMP [OPENMP]Fix the test to pacify buildbots, NFC. 2020-04-09 11:28:50 -04:00
PCH [AST] Fix an undefine behavior when creating an empty recovery expr. 2020-04-16 12:35:45 +02:00
Parser Rework how UuidAttr, CXXUuidofExpr, and GUID template arguments and constants are represented. 2020-04-15 12:20:42 -07:00
ParserSYCL [SYCL] Implement __builtin_unique_stable_name. 2020-03-25 07:01:50 -07:00
Preprocessor [clang] Add missing FileCheck colons 2020-04-14 12:32:48 -06:00
Profile Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
Refactor
Rewriter
Sema [clang] Add missing FileCheck colons 2020-04-14 12:32:48 -06:00
SemaCUDA [hip] Remove `hip_pinned_shadow`. 2020-04-07 09:51:49 -04:00
SemaCXX Disallow [[nodiscard]] on a function pointer declaration. 2020-04-16 09:28:49 -04:00
SemaObjC Revert "[ObjC generics] Fix not inheriting type bounds in categories/extensions." 2020-04-07 17:41:30 -07:00
SemaObjCXX [AST] Dont invalide VarDecl even the default initializaiton is failed. 2020-04-14 12:58:48 +02:00
SemaOpenCL [OpenCL] Add sub-group builtin functions 2020-04-02 13:18:56 +01:00
SemaOpenCLCXX Revert "[AST] Build recovery expressions by default for C++." 2020-03-26 16:25:32 +01:00
SemaSYCL [SYCL] Driver option to select SYCL version 2020-03-07 18:28:54 +03:00
SemaTemplate Fix template instantiation of a non-dependent call to an inherited 2020-04-06 19:20:30 -07:00
TableGen
Templight
Tooling [PowerPC] Delete PPCMachObjectWriter and powerpc{,64}-apple-darwin 2020-03-05 11:05:26 -08:00
Unit Revert a few unsuccessful attempts at fixing bots. 2020-04-13 17:09:21 -04:00
VFS [VFS] More consistent support for Windows 2020-02-05 11:38:20 -08:00
clang-rename [clang-rename] Fix the failure rename test. 2020-02-11 10:07:00 +01:00
utils/update_cc_test_checks Move update_cc_test_checks.py tests to clang 2020-02-14 14:39:55 +00:00
.clang-format
CMakeLists.txt Stop passing site cfg files via --param to llvm-lit. 2020-04-07 08:20:40 -04:00
TestRunner.sh
cxx-sections.data
lit.cfg.py Fix an indent. 2020-04-13 11:54:00 -04:00
lit.site.cfg.py.in Revert a few unsuccessful attempts at fixing bots. 2020-04-13 17:09:21 -04:00
make_test_dirs.pl