From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Thu, 17 May 2012 16:18:49 -0500 Subject: [U-Boot] [PATCH 5/6] cmd_nvedit.c: allow board-specific code before/after saving the environment In-Reply-To: <201205140120.45712.vapier@gentoo.org> References: <1336170092-22538-1-git-send-email-timur@freescale.com> <1336170092-22538-5-git-send-email-timur@freescale.com> <201205140120.45712.vapier@gentoo.org> Message-ID: <4FB56B39.9070803@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Mike Frysinger wrote: > this is less bloat: > int board_saveenv(void) __attribute__((weak, alias("saveenv"))); > > int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > { > printf("Saving Environment to %s...\n", env_name_spec); > return board_saveenv() ? 1 : 0; > } I don't think this can work: cmd_nvedit.c:599:5: error: 'board_saveenv' aliased to undefined symbol 'saveenv' cmd_nvedit.c:599:5: error: 'board_saveenv' aliased to undefined symbol 'saveenv' make[1]: *** [/home/b04825/git/u-boot.0/1022/common/cmd_nvedit.o] Error 1 It looks like weak functions can't be in another source file? If I change it to this, then it works: static int __saveenv(void) { return saveenv(); } int board_saveenv(void) __attribute__((weak, alias("__saveenv"))); int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { printf("Saving Environment to %s...\n", env_name_spec); return board_saveenv() ? 1 : 0; } -- Timur Tabi Linux kernel developer at Freescale