[PATCH] ld: Load the object only section when opening the mixed object file
H.J. Lu
hjl.tools@gmail.com
Thu Jan 16 23:40:47 GMT 2025
On Tue, Jan 14, 2025 at 11:59 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Since only mixed LTO and none-LTO relocatable output is only supported
> on ELF platforms, limit these tests to ELF targets. Since powerpc64
> elfv1 defines a function symbol on its procedure descriptor, which is in
> a data section, rather than on the code for that function, allow both D
> and T for nm test on mixed object.
>
It turns out that mixed LTO and non-LTO relocatable output works for
non-ELF targets. The issue is that the object only section is loaded
after all other input files have been loaded. This caused:
.../ld/collect-ld: /tmp/ccZAoUIW.obj-only.o: in function `main':
.../ld/testsuite/ld-plugin/lto-10a.c:4: multiple definition of `main';
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o):(.text.startup+0x0):
first defined here
.../ld/collect-ld:
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o):(.text.startup+0xc5):
undefined reference to `WinMain'
collect2: error: ld returned 1 exit status
...
FAIL: LTO 10
for x86_64-w64-mingw32.
Load the object only section when opening the mixed object file, instead
of loading it after all other input files have been loaded, fixed it. Here is
the patch.
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ld-Load-the-object-only-section-when-opening-the-mix.patch
Type: text/x-patch
Size: 7179 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20250117/78fffbcb/attachment-0001.bin>
More information about the Binutils
mailing list