[rtems commit] pc386: Fix linker usage issues with -r and function sections

Joel Sherrill joel at rtems.org
Fri Mar 11 22:08:19 UTC 2016


Module:    rtems
Branch:    master
Commit:    5e368e8441e21e484a09e0d743a5b6b934e45047
Changeset: http://git.rtems.org/rtems/commit/?id=5e368e8441e21e484a09e0d743a5b6b934e45047

Author:    Joel Sherrill <joel at rtems.org>
Date:      Fri Mar 11 16:07:35 2016 -0600

pc386: Fix linker usage issues with -r and function sections

closes #2638.

---

 c/src/lib/libbsp/i386/pc386/Makefile.am           | 4 ++++
 c/src/lib/libbsp/i386/pc386/make/custom/pc386.cfg | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am b/c/src/lib/libbsp/i386/pc386/Makefile.am
index c54307f..f79148b 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -201,6 +201,7 @@ noinst_PROGRAMS += ne2000.rel
 ne2000_rel_SOURCES = ne2000/ne2000.c
 ne2000_rel_CPPFLAGS = $(AM_CPPFLAGS) $(ne2000_CPPFLAGS)
 ne2000_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+ne2000_rel_LDFLAGS += -Wl,--undefined=rtems_ne_driver_attach
 endif
 
 if HAS_NETWORKING
@@ -214,6 +215,7 @@ wd8003_rel_SOURCES = wd8003/wd8003.c
 wd8003_rel_SOURCES += include/wd80x3.h
 wd8003_rel_CPPFLAGS = $(AM_CPPFLAGS) $(wd8003_CPPFLAGS)
 wd8003_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+wd8003_rel_LDFLAGS += -Wl,--undefined=rtems_wd_driver_attach
 endif
 
 if HAS_NETWORKING
@@ -225,6 +227,8 @@ noinst_PROGRAMS += 3c509.rel
 3c509_rel_SOURCES += 3c509/elink.h
 3c509_rel_CPPFLAGS = $(AM_CPPFLAGS) $(3c509_CPPFLAGS)
 3c509_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+3c509_rel_LDFLAGS += -Wl,--undefined=rtems_3c509_driver_attach
+3c509_rel_LDFLAGS += -Wl,--undefined=ep_board
 endif
 
 libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/cache.rel
diff --git a/c/src/lib/libbsp/i386/pc386/make/custom/pc386.cfg b/c/src/lib/libbsp/i386/pc386/make/custom/pc386.cfg
index af912e7..c878704 100644
--- a/c/src/lib/libbsp/i386/pc386/make/custom/pc386.cfg
+++ b/c/src/lib/libbsp/i386/pc386/make/custom/pc386.cfg
@@ -20,9 +20,9 @@ endif
 # optimize flag: typically -O2
 CFLAGS_OPTIMIZE_V = -O2 -g
 # Per function sections disabled per https://devel.rtems.org/ticket/2638
-# CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
-# 
-# LDFLAGS = -Wl,--gc-sections
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+ 
+LDFLAGS = -Wl,--gc-sections
 
 # Here is the rule to actually build a $(ARCH)/foo$(EXEEXT)
 # It also builds $(ARCH)/foo.sr and $(ARCH)/foo.nm




More information about the vc mailing list