[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/14539] ar can't generate correct archive
From: |
vapier at gentoo dot org |
Subject: |
[Bug binutils/14539] ar can't generate correct archive |
Date: |
Mon, 21 Feb 2022 19:19:31 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=14539
Mike Frysinger <vapier at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |NOTABUG
CC| |vapier at gentoo dot org
Status|NEW |RESOLVED
--- Comment #1 from Mike Frysinger <vapier at gentoo dot org> ---
i am by no means a fortran expert, so if i misunderstand how it works, feel
free to correct & reopen
the fact that this linking works:
> gfortran test_a.o lib_a.a -o a.exe
implies that the `use refs_a` is a "weak reference". that means the linker is
not required to pull in objects from an archive (.a) to satisfy such symbols
alone. this is how the linker has always behaved, and is always going to
behave.
if you want to force linking in all the objects from the archive, you can use
the --whole-archive option like:
gfortran test_a.o -Wl,--whole-archive lib_a.a -Wl,--no-whole-archive -o a.exe
from ar's pov, it is working correctly: it created an archive with an object.
it has nothing else to do.
from ld's pov, it is working correctly: the symbol is already satisfied, and
there's no objects it needs to pull out of the .a to satisfy missing symbols.
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug binutils/14539] ar can't generate correct archive,
vapier at gentoo dot org <=