<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Linking wine 32-bit binaries fails"
   href="https://bugs.llvm.org/show_bug.cgi?id=45670">45670</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Linking wine 32-bit binaries fails
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>COFF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>orgads@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In /usr/bin:
ln -sf ld.lld ld
(Here I used a script that outputs the flags before executing)

In wine build directory:
mkdir test
cd test
echo 'int wmain() {}' > test.c

../tools/winegcc/winegcc -v -save-temps --wine-objdir .. -m32 -fno-PIC
-fasynchronous-unwind-tables -mconsole -municode -mno-cygwin test.c

/usr/bin/gcc -m32 -fno-PIC -c -o test-hAIw1D.o -save-temps -fno-PIC
-fasynchronous-unwind-tables test.c

../tools/winebuild/winebuild -v --save-temps -fasynchronous-unwind-tables
"--cc-cmd=/usr/bin/gcc -m32" --ld-cmd=/usr/bin/ld -m32 -D_REENTRANT --exe -o
a.out-4B52c7.spec.o -F a.out --subsystem console --entry __wine_spec_exe_wentry
-L../dlls -L../libs/wine -- test-hAIw1D.o ../dlls/winecrt0/libwinecrt0.a
../dlls/msvcrt/libmsvcrt.a ../dlls/kernel32/libkernel32.def
../dlls/ntdll/libntdll.def
/usr/bin/gcc -m32 -xassembler -c -m32 -o a.2BcJJ5.o a.YRlrYC.s
/usr/bin/ld -m elf_i386 -r -o a.cZrasB.o a.2BcJJ5.o test-hAIw1D.o
../dlls/winecrt0/libwinecrt0.a ../dlls/msvcrt/libmsvcrt.a
ld.lld -m elf_i386 -r -o a.cZrasB.o a.2BcJJ5.o test-hAIw1D.o
../dlls/winecrt0/libwinecrt0.a ../dlls/msvcrt/libmsvcrt.a
/usr/bin/nm -u a.cZrasB.o
/usr/bin/gcc -m32 -xassembler -c -m32 -o a.out-4B52c7.spec.o a.Ocbvm8.s
Creating file try_link-5wRn6H.c
/usr/bin/gcc -m32 -m32 -o try_link-aAe0Zi.out -Wl,-z,max-page-size=0x1000
try_link-5wRn6H.c
Creating file try_link-6M3xBx.c
ld.lld -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccnUfjaP.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id
--eh-frame-hdr -m elf_i386 --hash-style=gnu --as-needed -shared -o a.out.so
/usr/lib/gcc/x86_64-linux-gnu/9/../../../i386-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/9/32/crtbeginS.o -L../dlls -L../libs/wine
-L/usr/lib/gcc/x86_64-linux-gnu/9/32
-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../i386-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib32 -L/lib/i386-linux-gnu
-L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32
-L/usr/lib/gcc/x86_64-linux-gnu/9
-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../i386-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. -L/lib/i386-linux-gnu
-L/usr/lib/i386-linux-gnu -Bsymbolic -z max-page-size=0x1000 -z defs -init
__wine_spec_init -fini __wine_spec_fini a.out-4B52c7.spec.o test-hAIw1D.o
../dlls/winecrt0/libwinecrt0.a ../dlls/msvcrt/libmsvcrt.a -lwine -lm -lc -lgcc
--push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed
-lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/32/crtendS.o
/usr/lib/gcc/x86_64-linux-gnu/9/../../../i386-linux-gnu/crtn.o
ld.lld: error: can't create dynamic relocation R_386_32 against local symbol in
readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to
allow text relocations in the output
<span class="quote">>>> defined in a.out-4B52c7.spec.o
>>> referenced by a.out-4B52c7.spec.o:(__wine_spec_import_thunks)</span >

ld.lld: error: can't create dynamic relocation R_386_32 against local symbol in
readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to
allow text relocations in the output
<span class="quote">>>> defined in a.out-4B52c7.spec.o
>>> referenced by a.out-4B52c7.spec.o:(__wine_spec_import_thunks)</span >

ld.lld: error: can't create dynamic relocation R_386_32 against local symbol in
readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to
allow text relocations in the output
<span class="quote">>>> defined in a.out-4B52c7.spec.o
>>> referenced by a.out-4B52c7.spec.o:(__wine_spec_import_thunks)</span >

ld.lld: error: can't create dynamic relocation R_386_32 against symbol:
__wine_spec_init_state in readonly segment; recompile object files with -fPIC
or pass '-Wl,-z,notext' to allow text relocations in the output
<span class="quote">>>> defined in ../dlls/winecrt0/libwinecrt0.a(init.o)
>>> referenced by exe_wentry.c:99 (../../../dlls/winecrt0/exe_wentry.c:99)
>>>               exe_wentry.o:(__wine_spec_exe_wentry) in archive ../dlls/winecrt0/libwinecrt0.a</span >

ld.lld: error: can't create dynamic relocation R_386_32 against symbol:
__wine_spec_init_state in readonly segment; recompile object files with -fPIC
or pass '-Wl,-z,notext' to allow text relocations in the output
<span class="quote">>>> defined in ../dlls/winecrt0/libwinecrt0.a(init.o)
>>> referenced by init.c:38 (../../../dlls/winecrt0/init.c:38)
>>>               init.o:(__wine_spec_init) in archive ../dlls/winecrt0/libwinecrt0.a</span >

etc...</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>