[llvm-bugs] [Bug 35570] New: reserved symbols specified in version script do not exist in linked output

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 7 19:40:39 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35570

            Bug ID: 35570
           Summary: reserved symbols specified in version script do not
                    exist in linked output
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: emaste at freebsd.org
                CC: llvm-bugs at lists.llvm.org

In FreeBSD's libc version script we include the linker-generated _end -
excerpt:

...
FBSDprivate_1.0 {
global:
...
        _end;
...
local:
        *;
} FBSD_1.5;

However the _end symbol does not appear in the output object:

% readelf -s /lib/libc.so.7 | grep -w _end
% 

When linked with ld.bfd we get:

% readelf -s /lib/libc.so.7 | grep -w _end
   197: 00000000005e8bc0     0 NOTYPE  GLOBAL DEFAULT  ABS
_end@@FBSDprivate_1.0 (8)
%

A sketch of a test case for this issue:

# REQUIRES: x86

# RUN: echo "FBSDprivate_1.0 { global: _end; local: *; };" > %t.script
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t.o
# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s

# CHECK:      DynamicSymbols [
# CHECK-NEXT:   Symbol {
# CHECK-NEXT:     Name: @
# CHECK-NEXT:     Value: 0x0
# CHECK-NEXT:     Size: 0
# CHECK-NEXT:     Binding: Local (0x0)
# CHECK-NEXT:     Type: None (0x0)
# CHECK-NEXT:     Other: 0
# CHECK-NEXT:     Section: Undefined (0x0)
# CHECK-NEXT:   }
# CHECK-NEXT:   Symbol {
# CHECK-NEXT:     Name: _end@@FBSDprivate_1.0
# CHECK-NEXT:     Value: 0
# CHECK-NEXT:     Size: 0
# CHECK-NEXT:     Binding: Global (0x1)
# CHECK-NEXT:     Type: None (0x0)
# CHECK-NEXT:     Other: 0
# CHECK-NEXT:     Section: Undefined (0x0)
# CHECK-NEXT:   }
# CHECK-NEXT: ]

.section .data
.globl _end
.globl bar
bar:
        .quad _end

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171208/5e2f4a1c/attachment.html>


More information about the llvm-bugs mailing list