mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-01-28 04:58:00 +00:00
as: handle .data section
This commit is contained in:
36
erlang/apps/as/priv/test5.s
Normal file
36
erlang/apps/as/priv/test5.s
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* test5.s
|
||||
* Copyright (C) 2019 Mikael Pettersson
|
||||
*
|
||||
* This file is part of pdp10-tools.
|
||||
*
|
||||
* pdp10-tools is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* pdp10-tools is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* test putting data in .text and code in .data */
|
||||
|
||||
.text
|
||||
.globl foo
|
||||
.type foo,@function
|
||||
foo:
|
||||
.long 0201040000033, 0263740000000
|
||||
.size foo,.-foo
|
||||
|
||||
.data
|
||||
.globl bar
|
||||
.type bar,@function
|
||||
bar:
|
||||
movei 1,033
|
||||
popj 017,
|
||||
.size bar,.-bar
|
||||
@@ -40,6 +40,10 @@ sections([Section | Sections], Tunit) ->
|
||||
|
||||
section(Section, Tunit) ->
|
||||
case Section of
|
||||
#section{ name = ".data" ++ _
|
||||
, sh_type = ?SHT_PROGBITS
|
||||
, sh_flags = ?SHF_ALLOC bor ?SHF_WRITE
|
||||
} -> stmts(Section, Tunit);
|
||||
#section{ name = ".text" ++ _
|
||||
, sh_type = ?SHT_PROGBITS
|
||||
, sh_flags = ?SHF_ALLOC bor ?SHF_EXECINSTR
|
||||
|
||||
@@ -286,7 +286,11 @@ pass2_sections([{SectionName, {Section, SubsectionsMap}} | Sections], Tunit0) ->
|
||||
{error, _Reason} = Error -> Error
|
||||
end.
|
||||
|
||||
pass2_subsections(_SectionName = ".text", SubsectionsMap, Tunit) ->
|
||||
pass2_subsections(SectionName, SubsectionsMap, Tunit) ->
|
||||
case SectionName of
|
||||
".data" ++ _ -> ok;
|
||||
".text" ++ _ -> ok
|
||||
end,
|
||||
pass2_subsections(lists:sort(maps:to_list(SubsectionsMap)), Tunit).
|
||||
|
||||
pass2_subsections([], Tunit) -> {ok, Tunit};
|
||||
|
||||
Reference in New Issue
Block a user