Hi,

On 1/5/26 16:43, Sascha Hauer wrote:
> On Mon, Jan 05, 2026 at 01:22:40PM +0100, Ahmad Fatoum wrote:
>>>  .SECONDEXPANSION:
>>>  $(symlink-y): $$(or $$(SYMLINK_DEP_$$(@F)),$$(SYMLINK_TARGET_$$(@F))) FORCE
>>> @@ -1091,6 +1094,17 @@ barebox.fit: 
>>> images/barebox-$(CONFIG_ARCH_LINUX_NAME).fit
>>>  barebox.srec: barebox
>>>     $(OBJCOPY) -O srec $< $@
>>>  
>>> +OBJCOPYFLAGS_barebox.elf = --strip-debug --strip-unneeded \
>>
>> --strip-section-headers goes the farthest I think.
> 
> The objcopy from the toolchain I used (binutils-2.40) doesn't support
> this option. A newer one I just upgraded to indeed does.

Interesting, --strip-all is the next best thing then, I think, so I'd suggest:

$(objcopy-option, --strip-section-headers, --strip-all)

With (untested):

# objcopy-option
# Usage: KBUILD_LDFLAGS += $(call objcopy-option, --strip-section-headers)
objcopy-option = $(call try-run,\
        $(CC) -x c /dev/null -c -o "$$TMPO"; $(OBJCOPY) $(1) "$$TMPO" 
"$$TMP",$(1),$(2))

>> OBJCOPYFLAGS_$@ = $your_options.
>>
>>
>> Sidenote: We should add --error-rwx-segments depending on
>> CONFIG_PBL_IMAGE_ELF.
> 
> Is this a objcopy option? My objcopy doesn't seem to support this.

See LDFLAGS_common += $(call ld-option,--no-warn-rwx-segments).

Cheers,
Ahmad

> 
> Sascha
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Reply via email to