The versioned symbol with the @@@ syntax is a special case. If the symbol
is not defined, 2 `@'s will be removed from the versioned_name. Otherwise,
1 `@' will be removed. But for malformed versioned symbols may not have
@@@:
.symver foo,foo@@@version1
.symver foo,foo@version2
Check @@@ before renaming the versioned symbol.
PR gas/33745
* config/obj-elf.c (elf_frob_file_before_adjust): Check @@@ before
renaming the versioned symbol.
* testsuite/gas/symver/symver.exp: Run symver17.
* testsuite/gas/symver/symver17.l: New file.
* testsuite/gas/symver/symver17.s: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
char *p = strchr (sy_obj->versioned_name->name,
ELF_VER_CHR);
- if (sy_obj->rename)
+ /* NB: Malformed versioned symbols may not have @@@. */
+ if (sy_obj->rename
+ && p[1] == ELF_VER_CHR
+ && p[2] == ELF_VER_CHR)
{
/* The @@@ syntax is a special case. If the symbol is
not defined, 2 `@'s will be removed from the
# run_error_test "symver5" ""
run_error_test "symver14" ""
run_error_test "symver15" ""
+ run_error_test "symver17" ""
}
--- /dev/null
+.*: Assembler messages:
+.*: Error: multiple versions \[`foo@version2'\|`foo@@@version1'\] for symbol `foo'
--- /dev/null
+ .symver foo,foo@@@version1
+ .symver foo,foo@version2