public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC For Embedded!?
@ 1999-12-22 18:42 CIH
  1999-12-23  2:15 ` Martin v. Loewis
  1999-12-31 23:54 ` CIH
  0 siblings, 2 replies; 9+ messages in thread
From: CIH @ 1999-12-22 18:42 UTC (permalink / raw)
  To: gcc

Hello...   ^o^

I develop embedded linux, I need smallest kernel and linux apps...

///////////////////////////////////////////////////////////////////////////////////////

/* File : test.c */
static void XYZ()
{
// The XYZ function code is very big...
}

static void test()
{
}

int main()
{
  test();

  return 1;
}
///////////////////////////////////////////////////////////////////////////////////////

# gcc -Wall -c test.c -o test
test.c:3: warning: `XYZ' defined but not used
///////////////////////////////////////////////////////////////////////////////////////

I find the ELF "test"...
When the very big function XYZ() is ever unused, but gcc still compiles
"XYZ" to "test"...

My god... I almost try all gcc command options, but "test" file still
has the very big function "XYZ"...

Anyone can help me!?   :~~~~~



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

* Re: GCC For Embedded!?
  1999-12-22 18:42 GCC For Embedded!? CIH
@ 1999-12-23  2:15 ` Martin v. Loewis
  1999-12-31 23:54   ` Martin v. Loewis
  1999-12-31 23:54 ` CIH
  1 sibling, 1 reply; 9+ messages in thread
From: Martin v. Loewis @ 1999-12-23  2:15 UTC (permalink / raw)
  To: cih; +Cc: gcc

> Anyone can help me!?   :~~~~~

Remove the function XYZ from the source if it is not used.

Martin

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

* GCC For Embedded!?
  1999-12-22 18:42 GCC For Embedded!? CIH
  1999-12-23  2:15 ` Martin v. Loewis
@ 1999-12-31 23:54 ` CIH
  1 sibling, 0 replies; 9+ messages in thread
From: CIH @ 1999-12-31 23:54 UTC (permalink / raw)
  To: gcc

Hello...   ^o^

I develop embedded linux, I need smallest kernel and linux apps...

///////////////////////////////////////////////////////////////////////////////////////

/* File : test.c */
static void XYZ()
{
// The XYZ function code is very big...
}

static void test()
{
}

int main()
{
  test();

  return 1;
}
///////////////////////////////////////////////////////////////////////////////////////

# gcc -Wall -c test.c -o test
test.c:3: warning: `XYZ' defined but not used
///////////////////////////////////////////////////////////////////////////////////////

I find the ELF "test"...
When the very big function XYZ() is ever unused, but gcc still compiles
"XYZ" to "test"...

My god... I almost try all gcc command options, but "test" file still
has the very big function "XYZ"...

Anyone can help me!?   :~~~~~



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

* Re: GCC For Embedded!?
  1999-12-23  2:15 ` Martin v. Loewis
@ 1999-12-31 23:54   ` Martin v. Loewis
  0 siblings, 0 replies; 9+ messages in thread
From: Martin v. Loewis @ 1999-12-31 23:54 UTC (permalink / raw)
  To: cih; +Cc: gcc

> Anyone can help me!?   :~~~~~

Remove the function XYZ from the source if it is not used.

Martin

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

* Re: GCC For Embedded!?
  2000-01-03 19:13   ` CIH
@ 2000-01-04  8:25     ` Manfred Hollstein
  0 siblings, 0 replies; 9+ messages in thread
From: Manfred Hollstein @ 2000-01-04  8:25 UTC (permalink / raw)
  To: cih; +Cc: mrs, cih, gcc

On Tue, 4 January 2000, 11:12:53, cih@xlinux.com wrote:

 > **********************************************************
 > # gcc -v
 > Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
 > gcc version 2.95.2 19991024 (release)
 > # ld -v
 > GNU ld version 2.9.5 (with BFD 2.9.5.0.22)
 > # gcc -ffunction-sections -fdata-sections -c -Wall test.c
 > test.c:2: warning: `XYZ' defined but not used
 > # nm test.o | grep XYZ
 > 00000000 t XYZ
 > # gcc -ffunction-sections -fdata-sections -Wl,--gc-sections test.o
 > # nm a.out | grep XYZ
 > 08048404 t XYZ
 > **********************************************************
 > Sorry...   I try...
 > But the XYZ still live in the file "a.out"...
 > 
 > Why?

Looks as if the support for these features has not been added to
the tools on Linux already :-(

From gcc/cp/News:

* Unused virtual functions can be discarded on some targets by specifying
  -ffunction-sections -fvtable-gc to the compiler and --gc-sections to the
  linker.  Unfortunately, this only works on Linux if you're linking
  statically.

FWIW, I checked this with a cross compiler Linux x arm-elf...

 > 
 > I always spend some time to modify gcc by myself...
 > Now All not used global function and variables could be cuted.
 > 
 > Now I try to cut local variables not used...
 > 
 > ^o^
 > 
 > 

manfred

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

* Re: GCC For Embedded!?
  2000-01-03  6:06 ` Manfred Hollstein
@ 2000-01-03 19:13   ` CIH
  2000-01-04  8:25     ` Manfred Hollstein
  0 siblings, 1 reply; 9+ messages in thread
From: CIH @ 2000-01-03 19:13 UTC (permalink / raw)
  To: Manfred Hollstein; +Cc: mrs, cih, gcc

**********************************************************
# gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
# ld -v
GNU ld version 2.9.5 (with BFD 2.9.5.0.22)
# gcc -ffunction-sections -fdata-sections -c -Wall test.c
test.c:2: warning: `XYZ' defined but not used
# nm test.o | grep XYZ
00000000 t XYZ
# gcc -ffunction-sections -fdata-sections -Wl,--gc-sections test.o
# nm a.out | grep XYZ
08048404 t XYZ
**********************************************************
Sorry...   I try...
But the XYZ still live in the file "a.out"...

Why?

I always spend some time to modify gcc by myself...
Now All not used global function and variables could be cuted.

Now I try to cut local variables not used...

^o^


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

* Re: GCC For Embedded!?
  1999-12-28 15:41 Mike Stump
  1999-12-31 23:54 ` Mike Stump
@ 2000-01-03  6:06 ` Manfred Hollstein
  2000-01-03 19:13   ` CIH
  1 sibling, 1 reply; 9+ messages in thread
From: Manfred Hollstein @ 2000-01-03  6:06 UTC (permalink / raw)
  To: mrs; +Cc: cih, gcc

On Tue, 28 December 1999, 15:41:39, mrs@windriver.com wrote:

 > > Date: Thu, 23 Dec 1999 10:41:03 +0800
 > > From: CIH <cih@wahoo.com.tw>
 > 
 > > static void XYZ()
 > > {
 > > // The XYZ function code is very big...
 > > }
 > 
 > > My god... I almost try all gcc command options, but "test" file still
 > > has the very big function "XYZ"...
 > 
 > compile with -ffunction-sections, and run the linker with
 > --gc-sections (sp?).

Also, add -fdata-sections; and, make sure, you've used these flags
when building your libs, too...

Use this:

$ ${target}-gcc -ffunction-sections -fdata-sections -c -Wall test.c
$ ${target}-nm test.o | grep XYZ
00000000 t XYZ
$ ${target}-gcc -ffunction-sections -fdata-sections -Wl,--gc-sections test.o
$ ${target}-nm a.out | grep XYZ
$ 

Cheers.

l8er
manfred

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

* Re: GCC For Embedded!?
  1999-12-28 15:41 Mike Stump
@ 1999-12-31 23:54 ` Mike Stump
  2000-01-03  6:06 ` Manfred Hollstein
  1 sibling, 0 replies; 9+ messages in thread
From: Mike Stump @ 1999-12-31 23:54 UTC (permalink / raw)
  To: cih, gcc

> Date: Thu, 23 Dec 1999 10:41:03 +0800
> From: CIH <cih@wahoo.com.tw>

> static void XYZ()
> {
> // The XYZ function code is very big...
> }

> My god... I almost try all gcc command options, but "test" file still
> has the very big function "XYZ"...

compile with -ffunction-sections, and run the linker with
--gc-sections (sp?).

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

* Re: GCC For Embedded!?
@ 1999-12-28 15:41 Mike Stump
  1999-12-31 23:54 ` Mike Stump
  2000-01-03  6:06 ` Manfred Hollstein
  0 siblings, 2 replies; 9+ messages in thread
From: Mike Stump @ 1999-12-28 15:41 UTC (permalink / raw)
  To: cih, gcc

> Date: Thu, 23 Dec 1999 10:41:03 +0800
> From: CIH <cih@wahoo.com.tw>

> static void XYZ()
> {
> // The XYZ function code is very big...
> }

> My god... I almost try all gcc command options, but "test" file still
> has the very big function "XYZ"...

compile with -ffunction-sections, and run the linker with
--gc-sections (sp?).

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

end of thread, other threads:[~2000-01-04  8:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-22 18:42 GCC For Embedded!? CIH
1999-12-23  2:15 ` Martin v. Loewis
1999-12-31 23:54   ` Martin v. Loewis
1999-12-31 23:54 ` CIH
1999-12-28 15:41 Mike Stump
1999-12-31 23:54 ` Mike Stump
2000-01-03  6:06 ` Manfred Hollstein
2000-01-03 19:13   ` CIH
2000-01-04  8:25     ` Manfred Hollstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).