elf_object.cc (7095:f7bb2d93cc49) elf_object.cc (7581:692cdb71febd)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 321 unchanged lines hidden (view full) ---

330
331 elf_end(elf);
332
333 // We will actually read the sections when we need to load them
334}
335
336
337bool
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 321 unchanged lines hidden (view full) ---

330
331 elf_end(elf);
332
333 // We will actually read the sections when we need to load them
334}
335
336
337bool
338ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding)
338ElfObject::loadSomeSymbols(SymbolTable *symtab, int binding, Addr mask)
339{
340 Elf *elf;
341 int sec_idx = 1; // there is a 0 but it is nothing, go figure
342 Elf_Scn *section;
343 GElf_Shdr shdr;
344 Elf_Data *data;
345 int count, ii;
346 bool found = false;

--- 23 unchanged lines hidden (view full) ---

370 data = elf_getdata(section, NULL);
371 count = shdr.sh_size / shdr.sh_entsize;
372 DPRINTF(Loader, "Found Symbol Table, %d symbols present\n", count);
373
374 // loop through all the symbols, only loading global ones
375 for (ii = 0; ii < count; ++ii) {
376 gelf_getsym(data, ii, &sym);
377 if (GELF_ST_BIND(sym.st_info) == binding) {
339{
340 Elf *elf;
341 int sec_idx = 1; // there is a 0 but it is nothing, go figure
342 Elf_Scn *section;
343 GElf_Shdr shdr;
344 Elf_Data *data;
345 int count, ii;
346 bool found = false;

--- 23 unchanged lines hidden (view full) ---

370 data = elf_getdata(section, NULL);
371 count = shdr.sh_size / shdr.sh_entsize;
372 DPRINTF(Loader, "Found Symbol Table, %d symbols present\n", count);
373
374 // loop through all the symbols, only loading global ones
375 for (ii = 0; ii < count; ++ii) {
376 gelf_getsym(data, ii, &sym);
377 if (GELF_ST_BIND(sym.st_info) == binding) {
378 symtab->insert(sym.st_value,
378 symtab->insert(sym.st_value & mask,
379 elf_strptr(elf, shdr.sh_link, sym.st_name));
380 }
381 }
382 }
383 ++sec_idx;
384 section = elf_getscn(elf, sec_idx);
385 }
386
387 elf_end(elf);
388
389 return found;
390}
391
392bool
393ElfObject::loadGlobalSymbols(SymbolTable *symtab, Addr addrMask)
394{
379 elf_strptr(elf, shdr.sh_link, sym.st_name));
380 }
381 }
382 }
383 ++sec_idx;
384 section = elf_getscn(elf, sec_idx);
385 }
386
387 elf_end(elf);
388
389 return found;
390}
391
392bool
393ElfObject::loadGlobalSymbols(SymbolTable *symtab, Addr addrMask)
394{
395 return loadSomeSymbols(symtab, STB_GLOBAL);
395 return loadSomeSymbols(symtab, STB_GLOBAL, addrMask);
396}
397
398bool
399ElfObject::loadLocalSymbols(SymbolTable *symtab, Addr addrMask)
400{
396}
397
398bool
399ElfObject::loadLocalSymbols(SymbolTable *symtab, Addr addrMask)
400{
401 return loadSomeSymbols(symtab, STB_LOCAL);
401 return loadSomeSymbols(symtab, STB_LOCAL, addrMask);
402}
403
404bool
405ElfObject::loadSections(Port *memPort, Addr addrMask)
406{
407 if (!ObjectFile::loadSections(memPort, addrMask))
408 return false;
409

--- 55 unchanged lines hidden ---
402}
403
404bool
405ElfObject::loadSections(Port *memPort, Addr addrMask)
406{
407 if (!ObjectFile::loadSections(memPort, addrMask))
408 return false;
409

--- 55 unchanged lines hidden ---