[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/26002] New: ld: Should an unversioned undefined symbol use VER_N
From: |
i at maskray dot me |
Subject: |
[Bug ld/26002] New: ld: Should an unversioned undefined symbol use VER_NDX_GLOBAL instead of VER_NDX_LOCAL? |
Date: |
Sun, 17 May 2020 00:21:01 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=26002
Bug ID: 26002
Summary: ld: Should an unversioned undefined symbol use
VER_NDX_GLOBAL instead of VER_NDX_LOCAL?
Product: binutils
Version: 2.35 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: i at maskray dot me
Target Milestone: ---
echo 'v1 { f; };' > a.ver
echo '.globl f_v1; .symver f_v1,f@v1; f_v1: g:' | as - -o a.o
ld.bfd -shared --version-script a.ver a.o -o a.so
echo '.symver f,f@v1; call f; call g' | as - -o a1.o
ld.bfd -shared a1.o a.so -o a1.so
% readelf -V a1.so
Version symbols section '.gnu.version' contains 2 entries:
Addr: 0x0000000000000204 Offset: 0x000204 Link: 3 (.dynsym)
000: 0 (*local*) 2 (v1)
Version needs section '.gnu.version_r' contains 1 entry:
Addr: 0x0000000000000208 Offset: 0x000208 Link: 4 (.dynstr)
000000: Version: 1 File: a.so Cnt: 1
0x0010: Name: v1 Flags: none Version: 2
Should `g` be VER_NDX_GLOBAL instead of VER_NDX_LOCAL?
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=64707334c75cdf16a0c2d317fc381c9b158beed9
may be related
- if (v == static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL))
+ // The Sun documentation says that V can be VER_NDX_LOCAL, or
+ // VER_NDX_GLOBAL, or a version index. The meaning of
+ // VER_NDX_LOCAL is defined as "Symbol has local scope." The
+ // old GNU linker will happily generate VER_NDX_LOCAL for an
+ // undefined symbol. I don't know what the Sun linker will
+ // generate.
+
+ if (v == static_cast<unsigned int>(elfcpp::VER_NDX_LOCAL)
+ && sym.get_st_shndx() != elfcpp::SHN_UNDEF)
# The build system has some robustness problems.
# I tried git checkout binutils-2_28; make; git checkout binutils-2_29; make;
... to iterate over recent releases. When I checkout binutils-2_33, `make` will
complain. (Deleting the build directory and regenerating it will work.) It
seems that some build artifacts from previous versions are not correctly
cleaned.
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug ld/26002] New: ld: Should an unversioned undefined symbol use VER_NDX_GLOBAL instead of VER_NDX_LOCAL?,
i at maskray dot me <=