bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/20276] New: LD fails to handle common symbol with LTO


From: hjl.tools at gmail dot com
Subject: [Bug ld/20276] New: LD fails to handle common symbol with LTO
Date: Sat, 18 Jun 2016 16:27:22 +0000

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

            Bug ID: 20276
           Summary: LD fails to handle common symbol with LTO
           Product: binutils
           Version: 2.27 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

address@hidden pr20267]$ cat main.c 
int global_var;
extern void abort ();

int main(void)
{
  if (global_var != 20)
    abort ();
  return 0;
}
address@hidden pr20267]$ cat foo.c
int global_var = 20;
address@hidden pr20267]$ make
gcc -B./ -O2 -flto -fno-lto -c main.c -o main.o
gcc -B./ -O2 -flto -c foo.c -o foo.o
ar cr --plugin `gcc -B./ -print-prog-name=liblto_plugin.so` libfoo.a foo.o
gcc -B./ -O2 -flto -o x main.o libfoo.a
gcc -B./ -O2 -flto -o y main.o foo.o
./ld: Warning: alignment 1 of symbol `global_var' in foo.o (symbol from plugin)
is smaller than 4 in main.o
main.o: In function `main':
main.c:(.text.startup+0x2): undefined reference to `global_var'
collect2: error: ld returned 1 exit status
Makefile:33: recipe for target 'y' failed
make: *** [y] Error 1
address@hidden pr20267]$

-- 
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]