From: Mike Frysinger Date: Fri, 10 Feb 2012 15:32:56 -0500 Subject: [U-Boot] [PATCH 2/2] RFC: Let linker create phy array In-Reply-To: <4F357260.2050408@aribaud.net> References: <1328410966-13946-1-git-send-email-troy.kisky@boundarydevices.com> <201202071020.45464.vapier@gentoo.org> <4F357260.2050408@aribaud.net> Message-ID: <201202101532.58695.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday 10 February 2012 14:39:12 Albert ARIBAUD wrote: > Le 07/02/2012 16:20, Mike Frysinger a ?crit : > > On Monday 06 February 2012 16:01:56 Albert ARIBAUD wrote: > >> Le 06/02/2012 21:57, Mike Frysinger a ?crit : > >>>> Is there a keep attribute like the linker has for sections? > >>> > >>> yes, __attribute__((used)) > >> > >> What is the point in adding a 'static' qualifier and a ((used)) > >> attribute, when not adding them in the first place gives the same > >> result? > > > > to control the visibility > > I don't understand what you mean with this. Can you please elaborate? no static means it has global elf visibility (other .c files can "extern" it, and you have to worry about symbol clashes): $ gcc -x c -c - -o test.o <<<'int foo;' && readelf -s test.o | grep foo 7: 0000000000000004 4 OBJECT GLOBAL DEFAULT COM foo static means it has local elf visibility (other files don't get access, and you don't have to worry about symbol clashes): $ gcc -x c -c - -o test.o <<<'static int foo;' && readelf -s test.o | grep foo 5: 0000000000000000 4 OBJECT LOCAL DEFAULT 3 foo imo, anything that should not be externally accessed should have "static". this is just good programming practice. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. URL: