[llvm-bugs] [Bug 27805] New: Wrong section VMA/LMA in case of using linker scripts

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 18 11:22:13 PDT 2016


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

            Bug ID: 27805
           Summary: Wrong section VMA/LMA in case of using linker scripts
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dstepanov.src at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16384
  --> https://llvm.org/bugs/attachment.cgi?id=16384&action=edit
The case to reproduce the problem.

The problem can be reproduced if:
1. More than one section with the same name is created. For example several
.rodata sections.
2. The linker script is used.

The following are the steps to reproduce the problem on llvm/clang/lld TOT:
1. Untar the attached test archive (test.tar.gz).
2. Set the CLANG_ROOT environment variable, for something like this:
$ export CLANG_ROOT=<your_llvm_build_dir>/bin/
3. Run make.
As a result you will get the following files:
A. tllvm_script: elf file linked with llvm/lld using script
B. tllvm_noscript: elf file linked with llvm/lld without any script
C. tgnu_script: elf file linked with GNU/ld using script
D. *.sec file for each elf file: it is just an output for the "objdump -h"
command.
The output will be similar too:
$ cat *.sec

tgnu_script:     file format elf64-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         0000005c  0000000000000000  0000000000000000  00200000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .rodata       0000002b  0000000000000060  0000000000000060  00200060  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .comment      000000a5  0000000000000000  0000000000000000  0020008b  2**0
                  CONTENTS, READONLY

tllvm_noscript:     file format elf64-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .rodata       0000001e  0000000000010120  0000000000010120  00000120  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .eh_frame     00000078  0000000000010140  0000000000010140  00000140  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .rodata       0000000d  00000000000101b8  00000000000101b8  000001b8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .text         0000005c  0000000000011000  0000000000011000  00001000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

tllvm_script:     file format elf64-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .eh_frame     00000078  0000000000000000  0000000000001000  00001000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .text         0000005c  0000000000000080  0000000000000080  00001080  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .rodata       0000001e  00000000000000e0  00000000000000e0  000010e0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .rodata       0000000d  0000000000000000  0000000000000000  00002000  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
The problem is in the tllvm_script.sec file. The second .rodata section
has a VMA and LMA adresses set to 0.

-- 
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/20160518/1275c34a/attachment.html>


More information about the llvm-bugs mailing list