aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elf.h1
-rw-r--r--tccelf.c11
2 files changed, 11 insertions, 1 deletions
diff --git a/elf.h b/elf.h
index d761747..68f3990 100644
--- a/elf.h
+++ b/elf.h
@@ -376,6 +376,7 @@ typedef struct
required */
#define SHF_GROUP (1 << 9) /* Section is member of a group. */
#define SHF_TLS (1 << 10) /* Section hold thread-local data. */
+#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
#define SHF_ORDERED (1 << 30) /* Special ordering requirement
diff --git a/tccelf.c b/tccelf.c
index 76f3da6..5dc1e70 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -2194,7 +2194,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
{
ElfW(Ehdr) ehdr;
ElfW(Shdr) *shdr, *sh;
- int size, i, j, offset, offseti, nb_syms, sym_index, ret;
+ int size, i, j, offset, offseti, nb_syms, sym_index, ret, seencompressed;
unsigned char *strsec, *strtab;
int *old_to_new_syms;
char *sh_name, *name;
@@ -2232,6 +2232,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
symtab = NULL;
strtab = NULL;
nb_syms = 0;
+ seencompressed = 0;
for(i = 1; i < ehdr.e_shnum; i++) {
sh = &shdr[i];
if (sh->sh_type == SHT_SYMTAB) {
@@ -2249,6 +2250,8 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
sh = &shdr[sh->sh_link];
strtab = load_data(fd, file_offset + sh->sh_offset, sh->sh_size);
}
+ if (sh->sh_flags & SHF_COMPRESSED)
+ seencompressed = 1;
}
/* now examine each section and try to merge its content with the
@@ -2272,6 +2275,12 @@ ST_FUNC int tcc_load_object_file(TCCState *s1,
strcmp(sh_name, ".stabstr")
)
continue;
+ if (seencompressed
+ && (!strncmp(sh_name, ".debug_", sizeof(".debug_")-1)
+ || (sh->sh_type == SHT_RELX
+ && !strncmp((char*)strsec + shdr[sh->sh_info].sh_name,
+ ".debug_", sizeof(".debug_")-1))))
+ continue;
if (sh->sh_addralign < 1)
sh->sh_addralign = 1;
/* find corresponding section, if any */