From: Michael Meissner Date: Fri, 12 Jan 1996 18:27:19 +0000 (+0000) Subject: Support for .sdata/.sbss/.sdata2/.sbss2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a83cc09fbcf2df02800bcfc8aaae925a5d8ad929;p=gcc.git Support for .sdata/.sbss/.sdata2/.sbss2 From-SVN: r10968 --- diff --git a/gcc/config/rs6000/eabi-ci.asm b/gcc/config/rs6000/eabi-ci.asm index 8c9822c9b1a..a9c605721c6 100644 --- a/gcc/config/rs6000/eabi-ci.asm +++ b/gcc/config/rs6000/eabi-ci.asm @@ -50,27 +50,50 @@ __GOT_START__: _GLOBAL_OFFSET_TABLE_: _SDA_BASE_: - .section ".got1","w" + .section ".got1","aw" .globl __GOT1_START__ .type __GOT1_START__,@object __GOT1_START__: - .section ".got2","w" + .section ".got2","aw" .globl __GOT2_START__ .type __GOT2_START__,@object __GOT2_START__: - .section ".fixup","w" + .section ".fixup","aw" .globl __FIXUP_START__ .type __FIXUP_START__,@object __FIXUP_START__: - .section ".ctors","w" + .section ".ctors","aw" .globl __CTOR_LIST__ .type __CTOR_LIST__,@object __CTOR_LIST__: - .section ".dtors","w" + .section ".dtors","aw" .globl __DTOR_LIST__ .type __DTOR_LIST__,@object __DTOR_LIST__: + + .section ".sdata","aw" + .globl __SDATA_START__ + .type __SDATA_START__,@object +__SDATA_START__: + + .section ".sbss","aw" + .globl __SBSS_START__ + .type __SBSS_START__,@object +__SBSS_START__: + + .section ".sdata2","aw" + .globl _SDA2_BASE_ + .type _SDA2_BASE_,@object + .globl __SDATA2_START__ + .type __SDATA2_START__,@object +__SDATA2_START__: +_SDA2_BASE_ = .+32768 + + .section ".sbss2","aw" + .globl __SBSS2_START__ + .type __SBSS2_START__,@object +__SBSS2_START__: diff --git a/gcc/config/rs6000/eabi-cn.asm b/gcc/config/rs6000/eabi-cn.asm index b026ed6af01..1d9b033175a 100644 --- a/gcc/config/rs6000/eabi-cn.asm +++ b/gcc/config/rs6000/eabi-cn.asm @@ -39,32 +39,59 @@ .file "crtn.s" .ident "GNU C crtn.s" - .section ".got","w" + .section ".got","aw" .globl __GOT_END__ .type __GOT_END__,@object __GOT_END__: - .section ".got1","w" + .section ".got1","aw" .globl __GOT1_END__ .type __GOT1_END__,@object __GOT1_END__: - .section ".got2","w" + .section ".got2","aw" .globl __GOT2_END__ .type __GOT2_END__,@object __GOT2_END__: - .section ".fixup","w" + .section ".fixup","aw" .globl __FIXUP_END__ .type __FIXUP_END__,@object __FIXUP_END__: - .section ".ctors","w" + .section ".ctors","aw" .globl __CTOR_END__ .type __CTOR_END__,@object __CTOR_END__: - .section ".dtors","w" + .section ".dtors","aw" .globl __DTOR_END__ .type __DTOR_END__,@object __DTOR_END__: + +# Put a blrl instruction in the special .got.blrl section, which +# the GNU linker puts at _GLOBAL_OFFSET_TABLE-4, so that a program +# can find the _GLOBAL_OFFSET_TABLE_ address in a painless fashion. + + .section ".got.blrl","awx" + blrl + + .section ".sdata","aw" + .globl __SDATA_END__ + .type __SDATA_END__,@object +__SDATA_END__: + + .section ".sbss","aw" + .globl __SBSS_END__ + .type __SBSS_END__,@object +__SBSS_END__: + + .section ".sdata2","aw" + .globl __SDATA2_END__ + .type __SDATA2_END__,@object +__SDATA2_END__: + + .section ".sbss2","aw" + .globl __SBSS2_END__ + .type __SBSS2_END__,@object +__SBSS2_END__: diff --git a/gcc/config/rs6000/eabi.asm b/gcc/config/rs6000/eabi.asm index dfd18fd3a15..e5483ed759a 100644 --- a/gcc/config/rs6000/eabi.asm +++ b/gcc/config/rs6000/eabi.asm @@ -48,14 +48,23 @@ .Ltable = .-.LCTOC1 .long .LCTOC1 /* address we are really at */ -.Lgot = .-.LCTOC1 - .long _GLOBAL_OFFSET_TABLE_ /* normal GOT address */ +.Lsda = .-.LCTOC1 + .long _SDA_BASE_ /* address of the first small data area */ -.Lgots = .-.LCTOC1 - .long __GOT_START__ /* start of .got section */ +.Lsdas = .-.LCTOC1 + .long __SDATA_START__ /* start of .sdata/.sbss section */ -.Lgote = .-.LCTOC1 - .long __GOT_END__ /* end of .got section */ +.Lsdae = .-.LCTOC1 + .long __SBSS_END__ /* end of .sdata/.sbss section */ + +.Lsda2 = .-.LCTOC1 + .long _SDA2_BASE_ /* address of the second small data area */ + +.Lsda2s = .-.LCTOC1 + .long __SDATA2_START__ /* start of .sdata2/.sbss2 section */ + +.Lsda2e = .-.LCTOC1 + .long __SBSS2_END__ /* end of .sdata2/.sbss2 section */ .Lgot2s = .-.LCTOC1 .long __GOT2_START__ /* -mrelocatable GOT pointers start */ @@ -110,20 +119,27 @@ FUNC_START(__eabi) stwx 1,10,12 /* store a non-zero value in the done flag */ bne 0,.Lreloc /* skip if we need to relocate */ -/* Only load up register 2 if there is a .got section */ +/* Only load up register 13 if there is a .sdata and/or .sbss section */ - lwz 3,.Lgots(11) /* start of .got section */ - lwz 4,.Lgote(11) /* end of .got section */ - cmpw 1,3,4 /* .got section non-empty? */ - bc 12,6,.Ldone + lwz 3,.Lsdas(11) /* start of .sdata/.sbss section */ + lwz 4,.Lsdae(11) /* end of .sdata/.sbss section */ + cmpw 1,3,4 /* .sdata/.sbss section non-empty? */ + beq 1,.Lsda2l /* skip loading r13 */ + + lwz 13,.Lsda(11) /* load r13 with _SDA_BASE address */ + +/* Only load up register 2 if there is a .sdata2 and/or .sbss2 section */ -/* Normal program, load up register 2 */ +.Lsda2l: + lwz 3,.Lsda2s(11) /* start of .sdata/.sbss section */ + lwz 4,.Lsda2e(11) /* end of .sdata/.sbss section */ + cmpw 1,3,4 /* .sdata/.sbss section non-empty? */ + beq 1,.Ldone /* skip loading r2 */ - lwz 2,.Lgot(11) /* normal GOT address (obsolete in register 2) */ - mr 13,2 /* also same as _SDA_BASE_ (V.4 small data ptr) */ + lwz 2,.Lsda2(11) /* load r2 with _SDA2_BASE address */ b FUNC_NAME(__do_global_ctors) /* do any C++ global constructors (which returns to caller) */ -/* We need to relocate the .got2 pointers. Don't load register 2 */ +/* We need to relocate the .got2 pointers. Don't load registers 2 or 13 */ .Lreloc: lwz 3,.Lgot2s(11) /* GOT pointers start */