gcc44, crtstuff: Provide -fPIE support
authorJohn Marino <draco@marino.st>
Sat, 9 Apr 2011 13:14:25 +0000 (15:14 +0200)
committerJohn Marino <draco@marino.st>
Sat, 9 Apr 2011 22:51:29 +0000 (00:51 +0200)
commite101389cdfc0ee127faf5259925a47b42b692580
tree3ac0574640985a5057e6ded6ee3fd14ecfb9fc57
parent3ea04d658d5525b1a365bd9a0133e5b2f3b85f0d
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.
contrib/gcc-4.4/gcc/config/dragonfly.h
lib/csu/i386/Makefile.csu
lib/csu/i386/crt1_c.c [moved from lib/csu/i386/crt1.c with 59% similarity]
lib/csu/i386/crt1_s.S [new file with mode: 0644]
lib/csu/x86_64/Makefile.csu