<html>
    <head>
      <base href="http://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 --- - -ffunction-sections and -fdata-sections for PE/COFF"
   href="http://llvm.org/bugs/show_bug.cgi?id=16101">16101</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-ffunction-sections and -fdata-sections for PE/COFF
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.2
          </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>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nruslan_devel@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
...</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>