Page MenuHomeFreeBSD

rtld-elf: link udivmoddi4 from compiler_rt
ClosedPublic

Authored by rlibby on Dec 18 2020, 4:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 3:27 AM
Unknown Object (File)
Dec 22 2023, 11:45 PM
Unknown Object (File)
Dec 11 2023, 7:04 AM
Unknown Object (File)
Nov 12 2023, 3:52 AM
Unknown Object (File)
Nov 10 2023, 12:35 PM
Unknown Object (File)
Nov 9 2023, 12:37 AM
Unknown Object (File)
Nov 8 2023, 5:34 PM
Unknown Object (File)
Nov 8 2023, 12:35 PM
Subscribers

Details

Summary

This fixes the gcc9 build of rtld-elf32 on amd64, which needed an
implementation of udivmoddi4.

rtld-elf uses certain functions normally found in libc, and so it
includes certain files from libc in its own build. It has two
mechanisms to include files from libc: one that rebuilds source files in
the rtld-elf environment, and one that extracts object files from a
purpose-built no-SSP PIC archive.

In addition to libc functions, rtld-elf may need to link functions
normally found in libcompiler_rt (formerly libgcc). Now, add an ability
to rebuild libcompiler_rt source files in the rtld-elf environment. We
don't yet have a need for an object file extraction mechanism.

libcompiler_rt could also supply udivdi3 and umoddi3, but leave them
alone for now.

Test Plan
env MAKEOBJDIRPREFIX=/usr/obj/gcc9 CROSS_TOOLCHAIN=amd64-gcc9 make buildworld
cc -m32 /tmp/hello.c -o /tmp/hello32
/usr/obj/gcc9/usr/src/freebsd/amd64.amd64/libexec/rtld-elf32/ld-elf32.so.1 -- /tmp/hello32

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

So SRCS are rebuild objects. and _libc_other_objects are extracted objects, right ?

What about adding e.g. Makefile.libc to rtld-elf/<arch> and including this file from rtld-libc/Makefile.inc.

This revision is now accepted and ready to land.Dec 18 2020, 5:01 AM
In D27665#618398, @kib wrote:

So SRCS are rebuild objects. and _libc_other_objects are extracted objects, right ?

That's right.

What about adding e.g. Makefile.libc to rtld-elf/<arch> and including this file from rtld-libc/Makefile.inc.

Hmm. Well I'd rather not add N new make files just for this, but, looking around, there are currently already <arch>/Makefile.inc files. We could piggy back on those and ask them to populate SRCS and a renamed _libc_other_objects_variable (RTLD_LIBC_OBJS?).

Do you have a preference? My goal here was just to get things working, I don't have strong feelings about it.

Hmm. Well I'd rather not add N new make files just for this, but, looking around, there are currently already <arch>/Makefile.inc files. We could piggy back on those and ask them to populate SRCS and a renamed _libc_other_objects_variable (RTLD_LIBC_OBJS?).

Do you have a preference? My goal here was just to get things working, I don't have strong feelings about it.

I am fine with reusing existing Makefile.inc's if that works. This would be a follow-up commit anyway.

In D27665#618428, @kib wrote:

Hmm. Well I'd rather not add N new make files just for this, but, looking around, there are currently already <arch>/Makefile.inc files. We could piggy back on those and ask them to populate SRCS and a renamed _libc_other_objects_variable (RTLD_LIBC_OBJS?).

Do you have a preference? My goal here was just to get things working, I don't have strong feelings about it.

I am fine with reusing existing Makefile.inc's if that works. This would be a follow-up commit anyway.

Okay. Thanks, I think this is indeed a cleaner suggestion. I'll come back to this after committing the initial fix.

This revision was automatically updated to reflect the committed changes.