[llvm-bugs] [Bug 38784] New: option --no-rosegment always group RO with X sections.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 30 20:01:56 PDT 2018


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

            Bug ID: 38784
           Summary: option --no-rosegment always group RO with X sections.
           Product: lld
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: pshung807 at gmail.com
                CC: llvm-bugs at lists.llvm.org

Take the following use case as an example.

# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: echo "SECTIONS { \
# RUN: .text : { *(.text) } \
# RUN: . = 0x200000;  \
# RUN: .rodata : { *(.rodata) } \
# RUN: }" > %t.script
# RUN: ld.lld --no-rosegment -o %t -T %t.script %t.o
# RUN: llvm-readelf -S %t | FileCheck %s

.text
nop
.rodata
        .word 0x41
        .word 0x42
        .word 0x43
        .word 0x44

----------------------------------------------------------------------

LLD --always groups RO section with X sections.
This decision generates a huge binary for the above case.
lld: put rodata and text into one segment, Binary size: 2.1M
bfd: put rodata and text into separate segments, Binary size: 8.7k


BTW, --no-rosegment seems to be removed by bfd linker. (my version is ld-2.31.)

-- 
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/20180831/05b59c98/attachment.html>


More information about the llvm-bugs mailing list