as: use SHN_ABS for section-less symbols in output stage, unbreaks .file

This commit is contained in:
Mikael Pettersson 2015-01-29 19:44:31 +00:00
parent 9854ccfbf3
commit 5c14e1a861

View File

@ -233,13 +233,19 @@ static int finalize_symbol(struct hashnode *hashnode, void *data)
{
struct symbol *symbol = (struct symbol*)hashnode;
struct finalize_symbol_context *fsctx = data;
Elf36_Word st_shndx;
fsctx->symtab[fsctx->i].st_name = symbol->st_name;
fsctx->symtab[fsctx->i].st_value = symbol->st_value;
fsctx->symtab[fsctx->i].st_size = symbol->st_size;
fsctx->symtab[fsctx->i].st_info = symbol->st_info;
fsctx->symtab[fsctx->i].st_other = STV_DEFAULT;
fsctx->symtab[fsctx->i].st_shndx = symbol->section->st_shndx;
if (symbol->section)
st_shndx = symbol->section->st_shndx;
else
st_shndx = SHN_ABS;
fsctx->symtab[fsctx->i].st_shndx = st_shndx;
++fsctx->i;