as: correct handling of ABS symbols

This commit is contained in:
Mikael Pettersson 2020-02-16 18:07:17 +01:00
parent 61cf333f58
commit 9d646d5fe8
3 changed files with 8 additions and 5 deletions

View File

@ -465,7 +465,7 @@ dot_byte(Location, Tunit, #s_dot_byte{} = Stmt0) ->
dot_file(_Location, Tunit, #s_dot_file{string = String}) ->
Symbol = #symbol{ name = String
, section = false
, section = abs
, st_value = 0
, st_size = 0
, st_info = ?ELF_ST_INFO(?STB_LOCAL, ?STT_FILE)

View File

@ -136,9 +136,12 @@ process_symbol(Symbol, Context) ->
#context{tunit = Tunit, strtab = StrTab} = Context,
{StName, NewStrTab} = strtab_enter(StrTab, Name),
StShndx =
case tunit:get_section(Tunit, Section) of
false -> ?SHN_ABS;
#section{shndx = Shndx} -> Shndx % assigned in append_section/2 above
case Section of
false -> ?SHN_UNDEF;
abs -> ?SHN_ABS;
_ ->
#section{shndx = Shndx} = tunit:get_section(Tunit, Section),
Shndx % assigned in append_section/2 above
end,
NewSymbol = Symbol#symbol{st_name = StName, st_shndx = StShndx},
NewTunit = tunit:put_symbol(Tunit, NewSymbol),

View File

@ -149,7 +149,7 @@
-record(symbol,
{ name :: string()
, section :: false | string() % false if UNDEF or ABS
, section :: false | abs | string()
%% FIXME: should contain an #elf36_Sym{} here instead
, st_value :: false | non_neg_integer()
, st_size :: false | non_neg_integer()