aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji _at_ gmail.com>2009-04-18 17:02:46 +0900
committergrischka <grischka>2009-04-18 15:08:03 +0200
commitd36fea34e36c7effc36592b214a2ff69fb97e844 (patch)
tree19a73e9bfb2681e5a400c98afe9700f92683e063
parentdd5630ff95b8dc47ab3b5ef3f167f3342da79a77 (diff)
downloadtinycc-d36fea34e36c7effc36592b214a2ff69fb97e844.tar.gz
tinycc-d36fea34e36c7effc36592b214a2ff69fb97e844.tar.bz2
Call relocate_sym() before we return the offset, so user doesn't need to check the return value twice.
-rw-r--r--tcc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tcc.c b/tcc.c
index 00758bc..597b58c 100644
--- a/tcc.c
+++ b/tcc.c
@@ -10353,6 +10353,11 @@ int tcc_relocate(TCCState *s1, void *ptr)
offset = (offset + length + 15) & ~15;
}
+ /* relocate symbols */
+ relocate_syms(s1, 1);
+ if (s1->nb_errors)
+ return -1;
+
#ifdef TCC_TARGET_X86_64
s1->runtime_plt_and_got_offset = 0;
s1->runtime_plt_and_got = (char *)(mem + offset);
@@ -10364,11 +10369,6 @@ int tcc_relocate(TCCState *s1, void *ptr)
if (0 == mem)
return offset + 15;
- /* relocate symbols */
- relocate_syms(s1, 1);
- if (s1->nb_errors)
- return -1;
-
/* relocate each section */
for(i = 1; i < s1->nb_sections; i++) {
s = s1->sections[i];