diff options
author | Roland McGrath <roland@gnu.org> | 1996-07-17 18:00:33 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-07-17 18:00:33 +0000 |
commit | 96e1bff2513873062233a13c7fd1eea57bb8db24 (patch) | |
tree | be4ff3e343ddcd37965163a0e1298b78503a7404 /csu/initfini.c | |
parent | 184b7b466a34e1e7f3c4824109e66bc1e7fdfe23 (diff) |
Updated from ../gpl2lgpl.sedcvs/libc-960717
Diffstat (limited to 'csu/initfini.c')
-rw-r--r-- | csu/initfini.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/csu/initfini.c b/csu/initfini.c index e4a7117130..6b12850a24 100644 --- a/csu/initfini.c +++ b/csu/initfini.c @@ -57,6 +57,15 @@ rm -f crti.s-new crtn.s-new\n\ mv crtcommon.tmp crti.s-new\n\ cp crti.s-new crtn.s-new"); +/* Extract a `.end' if one is produced by the compiler. */ +asm ("fgrep .end >/dev/null 2>&1 <<\\EOF.end && need_end=yes"); +void +useless_function (void) +{ + return; +} +asm ("\nEOF.end\n"); + /* Append the .init prologue to crti.s-new. */ asm ("cat >> crti.s-new <<\\EOF.crti.init"); @@ -77,8 +86,9 @@ _init (void) /* End the here document containing the .init prologue code. Then fetch the .section directive just written and append that to crtn.s-new, followed by the function epilogue. */ - asm (".end _init\n\ + asm ("\n\ EOF.crti.init\n\ + test -n \"$need_end\" && echo .end _init >> crti.s-new\n\ fgrep .init crti.s-new >>crtn.s-new\n\ fgrep -v .end >> crtn.s-new <<\\EOF.crtn.init"); } @@ -96,8 +106,8 @@ _fini (void) /* End the here document containing the .fini prologue code. Then fetch the .section directive just written and append that to crtn.s-new, followed by the function epilogue. */ - asm (".end _fini\n\ -EOF.crti.fini\n\ + asm ("\nEOF.crti.fini\n\ +test -n \"$need_end\" && echo .end _fini >> crti.s-new\n\ cat > /dev/null <<\\EOF.fini.skip"); { |