[lld] r266457 - [ELF] - Implemented basic location counter support.

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 14:57:26 PDT 2016


Hi,

It looks like we get a regression after this commit. Here is a
reproduction script.

% cat main.c
#include <stdio.h>
int main() {
  freopen("/dev/null", "w", stdout);
  puts("x");
  return 0;
}

% clang main.c -fuse-ld=lld
% ./a.out
Killed

Before this commit the output was "x".

I'm not sure but maybe the problem is related to files like libc.so.
On my machine this file is some sort of a linker script:
% cat /usr/lib/x86_64-linux-gnu/libc.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib/x86_64-linux-gnu/libc.so.6
/usr/lib/x86_64-linux-gnu/libc_nonshared.a  AS_NEEDED (
/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) )

This kind of files do not attempt to take complete control over
linking process, specify sections alignment etc. But we consider such
files as a real linker script and (if I understand the code properly)
switch off default processing.

On Fri, Apr 15, 2016 at 8:44 PM, George Rimar via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: grimar
> Date: Fri Apr 15 12:44:19 2016
> New Revision: 266457
>
> URL: http://llvm.org/viewvc/llvm-project?rev=266457&view=rev
> Log:
> [ELF] - Implemented basic location counter support.
>
> This patch implements location counter support.
> It also separates assign addresses for sections to assignAddressesScript() if it scipt exists.
>
> Main testcase is test/ELF/linkerscript-locationcounter.s, It contains some work with location counter. It is basic now.
> Implemented location counter assignment and '+' operations.
>
> Patch by myself with LOTS of comments and design suggestions from Rui Ueyama.
>
> Differential revision: http://reviews.llvm.org/D18499

-- 
Simon Atanasyan


More information about the llvm-commits mailing list