summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-05-05 20:21:03 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-05-05 20:21:03 +0000
commit502f65ae54d0fd7272e64988c162af8d1958f35c (patch)
tree6bd2a1d9499c502363dbc0487fbc8128be26b658 /clang/test
parent9c8c96f08a39496805a63f67761e0dc42b43e9cc (diff)
downloadbcm5719-llvm-502f65ae54d0fd7272e64988c162af8d1958f35c.tar.gz
bcm5719-llvm-502f65ae54d0fd7272e64988c162af8d1958f35c.zip
Fix pr19653.
Warn if an alias requests a section other than the aliasee section. llvm-svn: 207997
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/alias.c5
-rw-r--r--clang/test/Sema/attr-alias-elf.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGen/alias.c b/clang/test/CodeGen/alias.c
index 4a89b13be95..98449d36edf 100644
--- a/clang/test/CodeGen/alias.c
+++ b/clang/test/CodeGen/alias.c
@@ -16,6 +16,7 @@ extern void f1(void) __attribute((alias("f0")));
// CHECKBASIC-DAG: @f1 = alias void ()* @f0
// CHECKBASIC-DAG: @test8_foo = alias weak bitcast (void ()* @test8_bar to void (...)*)
// CHECKBASIC-DAG: @test8_zed = alias bitcast (void ()* @test8_bar to void (...)*)
+// CHECKBASIC-DAG: @test9_zed = alias void ()* @test9_bar
// CHECKBASIC: define void @f0() [[NUW:#[0-9]+]] {
// Make sure that aliases cause referenced values to be emitted.
@@ -54,3 +55,7 @@ int outer_weak(int a) { return inner_weak_a(a); }
void test8_bar() {}
void test8_foo() __attribute__((weak, alias("test8_bar")));
void test8_zed() __attribute__((alias("test8_foo")));
+
+void test9_bar(void) { }
+void test9_zed(void) __attribute__((section("test")));
+void test9_zed(void) __attribute__((alias("test9_bar")));
diff --git a/clang/test/Sema/attr-alias-elf.c b/clang/test/Sema/attr-alias-elf.c
index 01bc1879dc4..04d13924ac1 100644
--- a/clang/test/Sema/attr-alias-elf.c
+++ b/clang/test/Sema/attr-alias-elf.c
@@ -56,3 +56,11 @@ typedef int b4;
void test2_bar() {}
void test2_foo() __attribute__((weak, alias("test2_bar")));
void test2_zed() __attribute__((alias("test2_foo"))); // expected-warning {{alias will always resolve to test2_bar even if weak definition of alias test2_foo is overridden}}
+
+void test3_bar() { }
+void test3_foo() __attribute__((section("test"))); // expected-warning {{alias will not be in section 'test' but in the same section as the aliasee}}
+void test3_foo() __attribute__((alias("test3_bar")));
+
+__attribute__((section("test"))) void test4_bar() { }
+void test4_foo() __attribute__((section("test")));
+void test4_foo() __attribute__((alias("test4_bar")));
OpenPOWER on IntegriCloud