embeddedartistry / libc

libc targeted for embedded systems usage. Reduced set of functionality (due to embedded nature). Chosen for portability and quick bringup.
MIT License
504 stars 67 forks source link

Looking for option to create non-thin archive for libc #195

Open tdyjv opened 2 months ago

tdyjv commented 2 months ago

I am looking for an option to create a non-thin archive for libc (and libcpp etc.). I assume arm-none-eabi-ar (or the system ar) is invoked for building ARM libc, but I can not find the correct location to change the command line switches to create a "normal" archive instead of a thin one. A poke in the right direction would be appreciated - thanks in advance.

phillipjohnston commented 2 months ago

What’s the context for non-thin? LTO?On Jun 3, 2024, at 19:14, John Volpe @.***> wrote: I am looking for an option to create a non-thin archive from libc (and libcpp etc.). I assume arm-non-eabi-ar (or the system ar) is invoked for building ARM libc, but I can not find the correct location to change the command line switches to create a "normal" archive instead of a thin one. A poke in the right direction would be appreciated - thanks in advance.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

tdyjv commented 2 months ago

I'm not sure what LTO refers to, but the -T command line option on the archive "linker" command in $(BUILDRESULTS)/build.ninja makes the archive a thin one. The object files must go with libc.a for a link to succeed. I need to be use the libc.a file without a bunch of objects when linking our application.
The relevant lines in build.ninja contain "LINK_ARGS = csrDT". When I remove the "T" I get a libc.a which seems to be correct with the object files contained within the archive. So I'm looking for the source of the "csrDT" command line options so I can change how build.ninja is created.

phillipjohnston commented 2 months ago

I’m not doing anything to set that flag. Looks like along the way there was a meson change, perhaps the workaround is to set install: true for the libc library targets. I don’t see another way yet to disable that behavior.I never noticed bc my use through subprojects works fine with thin archive.

https://github.com/mesonbuild/meson/pull/9294

tdyjv commented 2 months ago

OK so for now I've added to the makefile to remove the 'T' after doing a meson setup. I'm off and running again

phillipjohnston commented 2 months ago

Just curious how you're doing that - are you just post-processing the generated ninja file to remove the flag?

tdyjv commented 2 months ago

Short answer - Yes

Changed libc Makefile rule adding the line in red :

Runs whenever the build has not been configured successfully

$(CONFIGURED_BUILD_DEP):       $(Q) $(MESON) setup $(BUILDRESULTS) $(INTERNAL_OPTIONS) $(OPTIONS)       sed -i 's%csrDT%csrD%' $(CONFIGURED_BUILD_DEP)

John Volpe Staff Software Engineer Teledyne Marine Systems Voice : 508-563-1562

NOTICE: This email message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally privileged and confidential information. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying, or other use of this message and its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to this message and please delete it from your computer.


From: Phillip Johnston @.> Sent: Thursday, June 6, 2024 14:38 To: embeddedartistry/libc @.> Cc: Volpe, John (US) @.>; Author @.> Subject: Re: [embeddedartistry/libc] Looking for option to create non-thin archive for libc (Issue #195)

External Email

Just curious how you're doing that - are you just post-processing the generated ninja file to remove the flag?

— Reply to this email directly, view it on GitHubhttps://github.com/embeddedartistry/libc/issues/195#issuecomment-2153162829, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABWJIPWPDEHHANEXLLDGI43ZGCUBBAVCNFSM6AAAAABIXSPSDGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJTGE3DEOBSHE. You are receiving this because you authored the thread.Message ID: @.***>