public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/105305] New: ARM32: gcc does not pass all library directories to linker
@ 2022-04-19  6:01 rui314 at gmail dot com
  2022-04-19  6:11 ` [Bug target/105305] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rui314 at gmail dot com @ 2022-04-19  6:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105305

            Bug ID: 105305
           Summary: ARM32: gcc does not pass all library directories to
                    linker
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rui314 at gmail dot com
  Target Milestone: ---

I'm the author of the mold linker (https://github.com/rui314/mold).

As far as I know, gcc always passes all library paths to the linker by -L<dir>,
but I got a bug report that that's not the case on ARM32. It is reported that
gcc does not pass some obvious paths such as `-L/usr` or `-L/usr/lib`. The code
to explicitly exclude "obvious" directories is here:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=bb07cc244e30fbeccc701816db888f497d65eb08;hb=refs/heads/master#l7931

mold and LLVM lld don't have the notion of the default search paths for the
sake of build reproducibility. They guarantee that as long as you pass the
exact same command line options and input files, the linkers behave exactly the
same regardless of the host machine (in LLD, that's guaranteed even across Unix
and Windows.) That helps us a lot when we do cross compilation.

So, can gcc pass all library paths to the linker on ARM32?

https://github.com/rui314/mold/issues/336

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/105305] ARM32: gcc does not pass all library directories to linker
  2022-04-19  6:01 [Bug c/105305] New: ARM32: gcc does not pass all library directories to linker rui314 at gmail dot com
@ 2022-04-19  6:11 ` pinskia at gcc dot gnu.org
  2022-11-03  4:11 ` pinskia at gcc dot gnu.org
  2022-11-03  4:25 ` rui314 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-04-19  6:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105305

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |arm*-*-*

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Gold also didn't search any by default.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/105305] ARM32: gcc does not pass all library directories to linker
  2022-04-19  6:01 [Bug c/105305] New: ARM32: gcc does not pass all library directories to linker rui314 at gmail dot com
  2022-04-19  6:11 ` [Bug target/105305] " pinskia at gcc dot gnu.org
@ 2022-11-03  4:11 ` pinskia at gcc dot gnu.org
  2022-11-03  4:25 ` rui314 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-03  4:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105305

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>The code to explicitly exclude "obvious" directories is here

That code has been there since before 1993. So I wonder if all other ld's
always included /usr and /usr/lib by default. It is only the newer ones which
don't.

Does POSIX say anything about ld behavior?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/105305] ARM32: gcc does not pass all library directories to linker
  2022-04-19  6:01 [Bug c/105305] New: ARM32: gcc does not pass all library directories to linker rui314 at gmail dot com
  2022-04-19  6:11 ` [Bug target/105305] " pinskia at gcc dot gnu.org
  2022-11-03  4:11 ` pinskia at gcc dot gnu.org
@ 2022-11-03  4:25 ` rui314 at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rui314 at gmail dot com @ 2022-11-03  4:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105305

--- Comment #3 from Rui Ueyama <rui314 at gmail dot com> ---
By other ld's, what linkers did you have in your mind? If lld, mold and gold
don't hard code /usr and /usr/lib, then the only remaining linker is GNU ld.

It doesn't seem like POSIX says about the default library search paths. I don't
believe POSIX even mandates the existence of /usr and /usr/lib. macOS doesn't
have such directories, but IIUC macOS at least one point in the past certified
as POSIX compliant.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-03  4:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19  6:01 [Bug c/105305] New: ARM32: gcc does not pass all library directories to linker rui314 at gmail dot com
2022-04-19  6:11 ` [Bug target/105305] " pinskia at gcc dot gnu.org
2022-11-03  4:11 ` pinskia at gcc dot gnu.org
2022-11-03  4:25 ` rui314 at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).