Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/Common/standalone/VersionScriptAnonymousMixed/Inputs/1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
void foo() {}
void bar() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
global: bar;
};
VER_1.0 {
global: foo;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
VER_1.0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add a test where anonymous version is first and then we have named version node?

Copy link
Copy Markdown
Author

@sai18022001 sai18022001 May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parth-07
The anonymous-first case produces a different error: EOF expected, but got VER_1.0 rather than the anonymous version definition is used in combination with other version definitions .
Should I add a separate CHECK for that error ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please add a separate check for that.

global: foo;
};
{
global: bar;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#---VersionScriptAnonymousMixed.test--------------------- SharedLibrary,VS------------------#
#BEGIN_COMMENT
# Test that an error is emitted when an anonymous version definition
# is used in combination with other named version definitions
# in a version script.
#END_COMMENT

RUN: %clang %clangopts -c -fpic %p/Inputs/1.c -o %t1.o
RUN: %not %link %linkopts -shared -o %t1.so %t1.o --version-script=%p/Inputs/vs_mixed 2>&1 | %filecheck %s --check-prefix=NAMED
RUN: %not %link %linkopts -shared -o %t1.so %t1.o --version-script=%p/Inputs/vs_anon_first 2>&1 | %filecheck %s --check-prefix=ANON

NAMED: Error: {{.*}}: anonymous version definition is used in combination with other version definitions
ANON: Error: {{.*}}: EOF expected, but got VER_1.0
Loading