git: gcc44, crtstuff: Provide -fPIE support
John Marino
marino at crater.dragonflybsd.org
Sat Apr 9 15:57:59 PDT 2011
commit e101389cdfc0ee127faf5259925a47b42b692580
Author: John Marino <draco at marino.st>
Date: Sat Apr 9 15:14:25 2011 +0200
gcc44, crtstuff: Provide -fPIE support
Properly support Position Independent Executables (PIE) generation by
linking PIE binaries with specially-built Scrt1.o instead of crt1.o.
The latter is built without the -fPIC flag.
For the i386 version, gcc-2 code was first purged, and then the new
assembly was placed in a separate file. All data extracted by the
assembler stub as explicit parameters. The hidden _start1 symbol is used
as an interface between the assembly and C code.
The CFLAGS -fkeep-inline-functions was removed as it was legacy FreeBSD
code that has been long since removed. The CFLAGS -elf was removed as
all DragonFly targets are elf. The LDFLAGS -elf was removed because it
was getting interpreted as "-entry=lf" by ld. LDFLAGS weren't even used
before this commit so it's always been completely extraneous.
For x86_64, the no-omit-frame-pointer flag was added during the build of
crt1.o. For the builtin gcc function __builtin_frame_address to work, all
call frames need to save the frame pointer. In particular, this is
important for the upper frame that should terminate the chain.
Summary of changes:
contrib/gcc-4.4/gcc/config/dragonfly.h | 15 ++-
lib/csu/i386/Makefile.csu | 31 +++++--
lib/csu/i386/crt1.c | 147 --------------------------------
lib/csu/i386/crt1_c.c | 96 +++++++++++++++++++++
lib/csu/i386/crt1_s.S | 49 +++++++++++
lib/csu/x86_64/Makefile.csu | 6 +-
6 files changed, 182 insertions(+), 162 deletions(-)
delete mode 100644 lib/csu/i386/crt1.c
create mode 100644 lib/csu/i386/crt1_c.c
create mode 100644 lib/csu/i386/crt1_s.S
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e101389cdfc0ee127faf5259925a47b42b692580
--
DragonFly BSD source repository
More information about the Commits
mailing list