[LLVMbugs] [Bug 16101] New: -ffunction-sections and -fdata-sections for PE/COFF

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 21 19:57:01 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16101

            Bug ID: 16101
           Summary: -ffunction-sections and -fdata-sections for PE/COFF
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nruslan_devel at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Does not seem to work for PE/COFF even though it works when I compile using
MinGW.

It should create separate sections (.text and .data), so that linker can
garbage collect unused code/data using --gc-sections option (ld)

Test:
int func1()
{
    return 0;
}

int func2()
{
    return 0;
}

Clang Output (objdump):
------------------
(-ccc-host-triple x86_64-pc-mingw32)

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         00000013  0000000000000000  0000000000000000  0000003c  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
SYMBOL TABLE:
[  0](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x0000000000000000 .text
AUX scnlen 0x13 nreloc 0 nlnno 0 checksum 0x0 assoc 1 comdat 0
[  2](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x0000000000000000 func1
[  3](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x0000000000000010 func2


MinGW Output (objdump):
---------------------
...
  3 .text$func1   00000010  0000000000000000  0000000000000000  0000017c  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  4 .xdata$func1  00000004  0000000000000000  0000000000000000  0000018c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .pdata$func1  0000000c  0000000000000000  0000000000000000  00000190  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  6 .text$func2   00000010  0000000000000000  0000000000000000  0000019c  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  7 .xdata$func2  00000004  0000000000000000  0000000000000000  000001ac  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .pdata$func2  0000000c  0000000000000000  0000000000000000  000001b0  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
...

-- 
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/20130522/e6f8afe8/attachment.html>


More information about the llvm-bugs mailing list