<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Wrong section VMA/LMA in case of using linker scripts"
   href="https://llvm.org/bugs/show_bug.cgi?id=27805">27805</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong section VMA/LMA in case of using linker scripts
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dstepanov.src@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16384" name="attach_16384" title="The case to reproduce the problem.">attachment 16384</a> <a href="attachment.cgi?id=16384&action=edit" title="The case to reproduce the problem.">[details]</a></span>
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 .<a href="show_bug.cgi?id=27805#c000000">comment      000000</a>a5  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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>