mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 00/16] Remove dependency on ld --gc-section in PBL
@ 2024-11-25 15:12 Ahmad Fatoum
  2024-11-25 15:12 ` [PATCH v2 01/16] scripts: include: add definitions for printk and BUG() Ahmad Fatoum
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Ahmad Fatoum @ 2024-11-25 15:12 UTC (permalink / raw)
  To: barebox

We depend on -ffunction-sections -fdata-sections at a lot of places and
fail the link without due to undefined references. This is especially
needed for obj-pbl-y code as the files usually have other functions
depending on barebox proper infrastructure, but that is never called.

This works so far, but breaks for two things: LTO and using PBL on
sandbox. Both I have not managed to get the linker not to complain about
the undefined references in the ultimately unreferenced code.

Therefore, let's solve this a different way: Adjust the relevant headers
to define stubs when built for sandbox.

This has the nice side effect of compile testing the stubs during PBL
build, so forgotten semicolons are more likely to be noticed during
development instead of CI run.

v1 -> v2:
  - squash fixes noticed by CI (strerror, PBL_CONSOLE)
  - define printk/BUG for host tools to fix compile error
  - replace IS_PROPER macro with new global IN_PROPER macro
  - use IN_PROPER where appropriate

Ahmad Fatoum (16):
  scripts: include: add definitions for printk and BUG()
  xfuncs: include <malloc.h> for free definition
  pbl: define IN_PBL & IN_PROPER macros globally
  treewide: replace inverted check for PBL with new IN_PROPER macro
  lib: random: add stubs for PBL
  bootsource: stub out when in PBL
  crypto: provide crypto_memneq for PBL
  cdev: stub out cdev_read/write for PBL
  libfile: stub out file descriptor API for PBL
  environment: stub out environment API for PBL
  of: stub out live tree API when using PBL
  errno: stub out perror/strerror API when built for PBL
  xfuncs: stub out API when built for PBL
  stdio: stub out basprintf and friends when built for PBL
  memory: stub out request_barebox_region for PBL
  malloc: add PBL stubs

 arch/arm/mach-imx/romapi.c         |  2 +-
 arch/arm/mach-omap/omap3_generic.c |  2 +-
 arch/riscv/include/asm/unwind.h    |  2 +-
 common/bootsource.c                |  2 +-
 crypto/Makefile                    |  2 +-
 drivers/pinctrl/imx-iomux-v1.c     |  2 +-
 fs/fat/ff.h                        |  2 +-
 include/abort.h                    |  2 +-
 include/dma.h                      |  2 +-
 include/driver.h                   | 24 +++++++++-
 include/environment.h              |  2 +-
 include/errno.h                    | 10 +++++
 include/fcntl.h                    |  8 ++++
 include/libfile.h                  |  7 +++
 include/linux/iopoll.h             |  4 +-
 include/linux/kasan.h              |  2 +-
 include/linux/kconfig.h            |  8 ++++
 include/linux/list.h               |  2 +-
 include/linux/printk.h             |  4 +-
 include/linux/string.h             |  7 +++
 include/malloc.h                   | 37 +++++++++++++++
 include/memory.h                   | 10 +++++
 include/of.h                       |  2 +-
 include/pbl.h                      |  6 ---
 include/printk.h                   |  4 +-
 include/stdio.h                    | 28 ++++++++++--
 include/stdlib.h                   | 19 +++++++-
 include/unistd.h                   | 72 ++++++++++++++++++++++++++++++
 include/xfuncs.h                   | 20 +++++++++
 include/zero_page.h                |  2 +-
 lib/vsprintf.c                     |  4 +-
 scripts/include/asm-generic/bug.h  | 14 ++++++
 scripts/include/linux/bug.h        |  1 +
 scripts/include/printk.h           |  9 ++++
 34 files changed, 289 insertions(+), 35 deletions(-)
 create mode 100644 scripts/include/asm-generic/bug.h
 create mode 100644 scripts/include/linux/bug.h
 create mode 100644 scripts/include/printk.h

-- 
2.39.5




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

end of thread, other threads:[~2024-11-25 15:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-25 15:12 [PATCH v2 00/16] Remove dependency on ld --gc-section in PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 01/16] scripts: include: add definitions for printk and BUG() Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 02/16] xfuncs: include <malloc.h> for free definition Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 03/16] pbl: define IN_PBL & IN_PROPER macros globally Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 04/16] treewide: replace inverted check for PBL with new IN_PROPER macro Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 05/16] lib: random: add stubs for PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 06/16] bootsource: stub out when in PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 07/16] crypto: provide crypto_memneq for PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 08/16] cdev: stub out cdev_read/write " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 09/16] libfile: stub out file descriptor API " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 10/16] environment: stub out environment " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 11/16] of: stub out live tree API when using PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 12/16] errno: stub out perror/strerror API when built for PBL Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 13/16] xfuncs: stub out " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 14/16] stdio: stub out basprintf and friends " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 15/16] memory: stub out request_barebox_region " Ahmad Fatoum
2024-11-25 15:12 ` [PATCH v2 16/16] malloc: add PBL stubs Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox