X-Git-Url: https://git.stricted.de/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Frecordmcount.c;h=8c9ffe27a08366911ea87ff31c2538631c227a3d;hb=HEAD;hp=e11aa4a156d2d26df48706d0da0a7970813e9798;hpb=875966bda8f6e636b5c75a5afeb9eb5f18795368;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index e11aa4a156d2..8c9ffe27a083 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c @@ -33,10 +33,17 @@ #include #include +/* + * glibc synced up and added the metag number but didn't add the relocations. + * Work around this in a crude manner for now. + */ #ifndef EM_METAG -/* Remove this when these make it to the standard system elf.h. */ #define EM_METAG 174 +#endif +#ifndef R_METAG_ADDR32 #define R_METAG_ADDR32 2 +#endif +#ifndef R_METAG_NONE #define R_METAG_NONE 3 #endif @@ -194,6 +201,20 @@ static void *mmap_file(char const *fname) addr = umalloc(sb.st_size); uread(fd_map, addr, sb.st_size); } + if (sb.st_nlink != 1) { + /* file is hard-linked, break the hard link */ + close(fd_map); + if (unlink(fname) < 0) { + perror(fname); + fail_file(); + } + fd_map = open(fname, O_RDWR | O_CREAT, sb.st_mode); + if (fd_map < 0) { + perror(fname); + fail_file(); + } + uwrite(fd_map, addr, sb.st_size); + } return addr; }