diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-02-20 18:08:57 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-02-20 18:08:57 +0000 |
commit | 6b07a1c6ee50dcf4d52a4a314b4774347f9b22c0 (patch) | |
tree | 4cc8c21d84f5ad56ef4c8addf953a1cab14f5b5b /clang/test | |
parent | 5c56fb55b0857181d7bb89c40cce9d87c0942c00 (diff) | |
download | bcm5719-llvm-6b07a1c6ee50dcf4d52a4a314b4774347f9b22c0.tar.gz bcm5719-llvm-6b07a1c6ee50dcf4d52a4a314b4774347f9b22c0.zip |
Add -funique-section-names and -fno-unique-section-names options.
For now -funique-section-names is the default, so no change in default behavior.
The total .o size in a build of llvm and clang goes from 241687775 to 230649031
bytes if -fno-unique-section-names is used.
llvm-svn: 230031
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/funique-sections.c | 13 | ||||
-rw-r--r-- | clang/test/Driver/function-sections.c | 12 |
2 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/CodeGen/funique-sections.c b/clang/test/CodeGen/funique-sections.c new file mode 100644 index 00000000000..1473fe57db0 --- /dev/null +++ b/clang/test/CodeGen/funique-sections.c @@ -0,0 +1,13 @@ +// REQUIRES: x86-registered-target + +// RUN: %clang_cc1 -triple x86_64-pc-linux -S -ffunction-sections -fdata-sections -fno-unique-section-names -o - < %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-pc-linux -S -ffunction-sections -fdata-sections -o - < %s | FileCheck %s --check-prefix=UNIQUE + +const int hello = 123; +void world() {} + +// CHECK: .section .text,"ax",@progbits,unique +// CHECK: .section .rodata,"a",@progbits,unique + +// UNIQUE: .section .text.world,"ax",@progbits +// UNIQUE: .section .rodata.hello,"a",@progbits diff --git a/clang/test/Driver/function-sections.c b/clang/test/Driver/function-sections.c index fe6d303e3ec..ba065b1367a 100644 --- a/clang/test/Driver/function-sections.c +++ b/clang/test/Driver/function-sections.c @@ -4,6 +4,8 @@ // CHECK-NOFS-NOT: -ffunction-sections // CHECK-DS: -fdata-sections // CHECK-NODS-NOT: -fdata-sections +// CHECK-US-NOT: -fno-unique-section-names +// CHECK-NOUS: -fno-unique-section-names // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ // RUN: -target i386-unknown-linux \ @@ -60,3 +62,13 @@ // RUN: -fdata-sections -fno-data-sections -fdata-sections \ // RUN: | FileCheck --check-prefix=CHECK-DS %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: -funique-section-names \ +// RUN: | FileCheck --check-prefix=CHECK-US %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: -fno-unique-section-names \ +// RUN: | FileCheck --check-prefix=CHECK-NOUS %s |