bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/19328] New: [AArch64] gold should issue an error if a shared l


From: ikudrin.dev at gmail dot com
Subject: [Bug gold/19328] New: [AArch64] gold should issue an error if a shared library is built from a non-PIC object
Date: Fri, 04 Dec 2015 11:53:41 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=19328

            Bug ID: 19328
           Summary: [AArch64] gold should issue an error if a shared
                    library is built from a non-PIC object
           Product: binutils
           Version: 2.27 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: ikudrin.dev at gmail dot com
                CC: ian at airs dot com
  Target Milestone: ---

On host (Ubuntu 15.10, x86_64):
$ cat d.c
int d = 5;
int f() { return d; }

$ cat m.c
#include <stdio.h>
int d = 42;
int f();
int main() {
        printf("%d\n", f());
        return 0;
}

$ aarch64-linux-gnu-gcc -c d.c -o d.nopic.o
$ gold.git -shared d.nopic.o -o d.gold.nopic.so
$ aarch64-linux-gnu-gcc m.c ./d.gold.nopic.so -o r.gold.nopic

$ aarch64-linux-gnu-gcc -c d.c -o d.pic.o -fPIC
$ gold.git -shared d.pic.o -o d.gold.pic.so
$ aarch64-linux-gnu-gcc m.c ./d.gold.pic.so -o r.gold.pic

Note: gold.git is just built from git sources.

On VM with AArch64 Debian:
$ ./r.gold.nopic
5
$ ./r.gold.pic
42

Expected bahavior: should report an error similar to other targets:
$ gcc -c d.c -o d.nopic.o
$ ld.gold -shared d.nopic.o -o d.nopic.so
ld.gold: error: d.nopic.o: requires dynamic R_X86_64_PC32 reloc against 'd'
which may overflow at runtime; recompile with -fPIC

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]